![]() |
Creates a new editable PDF file with encryption.
public int PdfNewPdf( String FilePath, String Title, String Author, String Subject, String Keywords, String Creator, PdfEncryption Encryption, PdfRight Rights, String UserPassword, String OwnerPassword );
Public Function PdfNewPdf( ByVal FilePath As String, ByVal Title As String, ByVal Author As String, ByVal Subject As String, ByVal Keywords As String, ByVal Creator As String, ByVal Encryption As PdfEncryption, ByVal Rights As PdfRight, ByVal UserPassword As String, ByVal OwnerPassword As String ) As Integer
|
Parameters |
Description |
|
FilePath |
The path of the PDF to create. |
|
Title |
The title of the PDF. |
|
Author |
The PDF Author. |
|
Subject |
The PDF Subject. |
|
Keywords |
The PDF Keywords. |
|
Creator |
The name of the application which creates the PDF. |
|
Encryption |
A member of the PdfEncryption enumeration. Note: AES encyption is not yet available. |
|
Rights |
A value returned by the PdfCreateRights function. |
|
UserPassword |
The user password for the PDF. Can be an empty string. |
|
OwnerPassword |
The owner password for the PDF. Can be an empty string. |
0: The PDF could not created. Use the GetStat() function to determine the reason this function failed.
Non-zero: A PDF Identifier.
A sample of PDF generation including 128 bits RC4 encryption & basic elements such as image & texts.
Dim oGdPictureImaging As New GdPictureImaging Dim PdfID As Integer Dim PDFImageID As Integer 'Pdf Image 1 idx Dim Font1ID As Integer 'Pdf Font 1 idx Dim Font2ID As Integer 'Pdf Font 2 idx Dim Font3ID As Integer 'Pdf Font 3 idx Dim Font4ID As Integer 'Pdf Font 4 idx Dim Font5ID As Integer 'Pdf Font 5 idx oGdPictureImaging.SetLicenseNumber("XXX") 'Replace XXX by a demo or commercial license key PdfID = oGdPictureImaging.PdfNewPdf("demo.pdf", "MyPdfTitle", "MyPdfAuthor", "MyPdfSubject", "MyPdfKeywords", "MyPdfCreator", 'PdfEncryption.PdfEncryption128BitRC4, PdfRight.PdfRightCanView Or PdfRight.PdfRightCanPrint, "UserPass", "OwnerPass") oGdPictureImaging.PdfSetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitCentimeter) 'First Step: Add all ressources (fonts & images) PDFImageID = oGdPictureImaging.PdfAddImageFromFile(PdfID, "") Font1ID = oGdPictureImaging.PdfAddTrueTypeFont(PdfID, "Arial", False, False) 'Add Arial font Font2ID = oGdPictureImaging.PdfAddTrueTypeFont(PdfID, "Arial", True, False) 'Add Arial Bold font Font3ID = oGdPictureImaging.PdfAddTrueTypeFont(PdfID, "Courier New", False, False) 'Add Courier new font Font4ID = oGdPictureImaging.PdfAddTrueTypeFont(PdfID, "Symbol", False, False) 'Add symbol font Font5ID = oGdPictureImaging.PdfAddTrueTypeFont(PdfID, "Times New Roman", False, True) 'Add Times NewRoman Italic 'Second Step: Make PDF 'Page 1 oGdPictureImaging.PdfNewPage(PdfID, 20, 15) 'Pages dimensions will be 20 x 15 cm oGdPictureImaging.PdfDrawImage(PdfID, PDFImageID, 10, 10, 3, 2.5) oGdPictureImaging.PdfDrawTextAlign(PdfID, 13, 9.5, "Arial Text Size 7 Align Right", Font1ID, 7, Color.Black, TextAlign.TextAlignRight) oGdPictureImaging.PdfDrawText(PdfID, 5, 10, "Arial Text Size 7", Font1ID, 7, Color.Black, 0) oGdPictureImaging.PdfDrawText(PdfID, 5, 9.5, "Arial Bold Text Bold Size 8", Font2ID, 8, Color.Black, 0) oGdPictureImaging.PdfDrawText(PdfID, 5, 9, "Courier new Text Size 8", Font3ID, 8, Color.Black, 0) oGdPictureImaging.PdfDrawText(PdfID, 5, 8.5, "ZapfDingbats Text Size 8", Font4ID, 8, Color.Black, 0) oGdPictureImaging.PdfDrawText(PdfID, 5, 8, "Times NewRoman Text Italic Size 8", Font5ID, 8, Color.Black, 0) oGdPictureImaging.PdfDrawText(PdfID, 8, 1, "Draw rotated text... http://www.gdpicture.com", Font5ID, 8, Color.Black, 0) oGdPictureImaging.PdfDrawText(PdfID, 8, 1, "Draw rotated text... http://www.gdpicture.com", Font5ID, 8, Color.Black, 45) oGdPictureImaging.PdfDrawText(PdfID, 8, 1, "Draw rotated text... http://www.gdpicture.com", Font5ID, 8, Color.Black, 90) oGdPictureImaging.PdfDrawText(PdfID, 8, 1, "Draw rotated text... http://www.gdpicture.com", Font5ID, 8, Color.Black, 135) oGdPictureImaging.PdfDrawText(PdfID, 8, 1, "Draw rotated text... http://www.gdpicture.com", Font5ID, 8, Color.Black, 180) 'Page 2 oGdPictureImaging.PdfNewPage(PdfID, 12, 12) 'Pages dimensions will be 12 x 12 cm oGdPictureImaging.PdfDrawText(PdfID, 5, 10, "Red Color Text", Font2ID, 8, Color.Red, 0) oGdPictureImaging.PdfDrawText(PdfID, 5, 9.5, "Green Color Text", Font2ID, 8, Color.Green, 0) oGdPictureImaging.PdfDrawText(PdfID, 5, 9, "Blue Color Text", Font2ID, 8, Color.Blue, 0) oGdPictureImaging.PdfSetTextHorizontalScaling(PdfID, 40) oGdPictureImaging.PdfDrawText(PdfID, 5, 6, "Compressed Text", Font1ID, 10, Color.Black, 0) oGdPictureImaging.PdfSetTextHorizontalScaling(PdfID, 200) oGdPictureImaging.PdfDrawText(PdfID, 5, 5.5, "Extended Text", Font1ID, 10, Color.Black, 0) oGdPictureImaging.PdfEndPdf(PdfID)
|
What do you think about this topic? Send feedback!
|
|
Copyright (c) 2009-2011 www.gdpicture.com. All rights reserved.
|