REDROOM
PHP 8.2.31
Path:
Logout
Edit File
Size: 1.74 KB
Close
//proc/thread-self/root/opt/alt/libharu/usr/share/libharu/bindings/c#/demo/Encryption.cs
Text
Base64
/* * << Haru Free PDF Library 2.0.5 >> -- Encryption.cs * * Copyright (c) 1999-2006 Takeshi Kanno <takeshi_kanno@est.hi-ho.ne.jp> * * Permission to use, copy, modify, distribute and sell this software * and its documentation for any purpose is hereby granted without fee, * provided that the above copyright notice appear in all copies and * that both that copyright notice and this permission notice appear * in supporting documentation. * It is provided "as is" without express or implied warranty. * */ using System; using System.IO; using HPdf; public class Encryption { public static void Main() { string owner_passwd = "owner"; string user_passwd = "user"; string text = "This is an encrypt document example."; Console.WriteLine("libhpdf-" + HPdfDoc.HPdfGetVersion()); try { HPdfDoc pdf = new HPdfDoc(); /* create default-font */ HPdfFont font = pdf.GetFont("Helvetica", null); /* add a new page object. */ HPdfPage page = pdf.AddPage(); page.SetSize(HPdfPageSizes.HPDF_PAGE_SIZE_B5, HPdfPageDirection.HPDF_PAGE_LANDSCAPE); page.BeginText(); page.SetFontAndSize(font, 20); float tw = page.TextWidth(text); page.MoveTextPos((page.GetWidth() - tw) / 2, (page.GetHeight() - 20) / 2); page.ShowText(text); page.EndText(); pdf.SetPassword(owner_passwd, user_passwd); /* save the document to a file */ pdf.SaveToFile("Encryption.pdf"); } catch (Exception e) { Console.Error.WriteLine(e.Message); } } }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 10
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
Encryption.cs
1.74 KB
lrw-r--r--
2025-03-11 14:13:06
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
FontDemo.cs
2.99 KB
lrw-r--r--
2025-03-11 14:13:06
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ImageDemo.cs
5.69 KB
lrw-r--r--
2025-03-11 14:13:06
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
JPFontDemo.cs
5.53 KB
lrw-r--r--
2025-03-11 14:13:06
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
LineDemo.cs
9.57 KB
lrw-r--r--
2025-03-11 14:13:06
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
OutlineDemo.cs
2.99 KB
lrw-r--r--
2025-03-11 14:13:06
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Permission.cs
1.92 KB
lrw-r--r--
2025-03-11 14:13:06
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
RawImageDemo.cs
3.60 KB
lrw-r--r--
2025-03-11 14:13:06
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
SlideShowDemo.cs
6.67 KB
lrw-r--r--
2025-03-11 14:13:06
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
TextDemo.cs
10.35 KB
lrw-r--r--
2025-03-11 14:13:06
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).