PdfNewPdfEx Method

See Also     Examples     Applies To

Creates a new PDF file and sets it as the native PDF.

Syntax

object.PdfNewPdfEx (sFilePath, sTitle, sAuthor, sSubject, sKeywords, sCreator, nPdfEncryption, nPDFRight, sUserpassWord, sOwnerPassword)

The PdfNewPdfEx syntax has these parts:

Part Description
object Required. An object expression that evaluates to an object in the Applies To list.
sFilePath Required. String. The path of the PDF to create.
sTitle Optional. String. Default value is "". The PDF Title.
sAuthor Optional. String. Default value is "". The PDF Author.
sSubject Optional. String. Default value is "". The PDF Subject.
sKeywords Optional. String. Default value is "". The PDF Keywords.
sCreator Optional. String. Default value is "". The PDF Creator.
nPdfEncryption Optional. Long. Default value is PdfEncryptionNone. Specifies if the PDF file must be encrypted.
Can be:
PdfEncryptionNone = 0 -> No encryption
PdfEncryption40BitRC4 = 1 -> 40 Bit RC4 encryption
PdfEncryption128BitRC4 = 2 -> 128Bit RC4 encryption
nPDFRight Optional. Long. Default value is PdfRightUndefined. A value returned by the PdfCreateRights function. Available only if nPdfEncryption is not null.
sUserpassWord Optional. String. Default value is "". The user password for the PDF. Can be an empty string. Available only if nPdfEncryption is not null.
sOwnerPassword Optional. String. Default value is "". The owner password for the PDF. Can be an empty string. Available only if nPdfEncryption is not null.

Returns

Boolean. True if the new pdf can be created else False.

Category

PDF Functions

Visual Basic Sample

A sample of new PDF creation, including basic elements like image & texts.


Dim nImageID As Long 'Pdf Image 1 idx
Dim nFont1ID As Long 'Pdf Font 1 idx
Dim nFont2ID As Long 'Pdf Font 2 idx
Dim nFont3ID As Long 'Pdf Font 3 idx
Dim nFont4ID As Long 'Pdf Font 4 idx
Dim nFont5ID As Long 'Pdf Font 5 idx

Call object.PdfNewPdfEx("demo.pdf")
object.PdfSetMeasurementUnits (2) 'measure unit is centimeters

'First Step: Add all ressources
nImageID = object.PdfAddImageFromFile("myimage.jpg")

nFont1ID = object.PdfAddFont("Arial") 'Add Arial font
nFont2ID = object.PdfAddFont("Arial", True) 'Add Arial Bold font
nFont3ID = object.PdfAddFont("Courier New") 'Add Courier new font
nFont4ID = object.PdfAddFont("Symbol") 'Add symbol font
nFont5ID = object.PdfAddFont("Times New Roman", False, True) 'Add Times NewRoman Italic

'Second Step: Make PDF

'Page 1
Call object.PdfSetPageDimensions(20, 15) 'Pages dimensions will be 20 x 15 cm
object.PdfNewPage

Call object.PdfDrawImage(nImageID, 10, 10, 3, 2.5)
Call object.PdfDrawTextAlign(13, 9.5, "Arial Text Size 7 Align Right", nFont1ID, 7, 1)
Call object.PdfDrawText(5, 10, "Arial Text Size 7", nFont1ID, 7)
Call object.PdfDrawText(5, 9.5, "Arial Bold Text Bold Size 8", nFont2ID, 8)
Call object.PdfDrawText(5, 9, "Courier new Text Size 8", nFont3ID, 8)
Call object.PdfDrawText(5, 8.5, "ZapfDingbats Text Size 8", nFont4ID, 8)
Call object.PdfDrawText(5, 8, "Times NewRoman Text Italic Size 8", nFont5ID, 8)
Call object.PdfDrawText(8, 1, "Draw rotated text...  http://www.gdpicture.com", nFont5ID, 8)
Call object.PdfDrawText(8, 1, "Draw rotated text...  http://www.gdpicture.com", nFont5ID, 8, 45)
Call object.PdfDrawText(8, 1, "Draw rotated text...  http://www.gdpicture.com", nFont5ID, 8, 90)
Call object.PdfDrawText(8, 1, "Draw rotated text...  http://www.gdpicture.com", nFont5ID, 8, 135)
Call object.PdfDrawText(8, 1, "Draw rotated text...  http://www.gdpicture.com", nFont5ID, 8, 180)

object.PdfEndPage 'End of page 1

'Page 2
Call object.PdfSetPageDimensions(12, 12) 'Pages dimensions will be 12 x 12 cm
object.PdfNewPage

object.PdfSetTextColor (object.GetRGB(255, 0, 0))
Call object.PdfDrawText(5, 10, "Red Color Text", nFont2ID, 8)

object.PdfSetTextColor (object.GetRGB(0, 255, 0))
Call object.PdfDrawText(5, 9.5, "Green Color Text", nFont2ID, 8)

object.PdfSetTextColor (object.GetRGB(0, 0, 255))
Call object.PdfDrawText(5, 9, "Blue Color Text", nFont2ID, 8)


object.PdfSetTextColor (object.GetRGB(0, 0, 0))
object.PdfSetTextHorizontalScaling (40)
Call object.PdfDrawText(5, 6, "Compressed Text", nFont1ID, 10)

object.PdfSetTextHorizontalScaling (200)
Call object.PdfDrawText(5, 5.5, "Extended Text", nFont1ID, 10)


object.PdfEndPage 'End of page 2

object.PdfSavePdf
MsgBox "Done!"






© Copyright 2008 GdPicture All rights reserved.
Documentation MAP.