Components for Developers
© 2000-2012, Two Pilots

PDF Library Download Features Manual Tutorials FAQ Pricing HTML2PDF-X Pilot History In the Lab

PDF Creator Pilot documentation

Download CHM version of this manual.
General document methods
Abort
Aborted
AddColorTransformationRule
AddImageFromBitmapHandle
AddImageFromBuffer
AddImageFromFile
AddImageFromFilename
AddImageFromMemory
AddImageWithColorMask
AddImageWithMask
AddTTFFontFromFile
AddTTFFontFromFile2
AddType1FontFromFile
AutoCreateURL
AutoLaunch
BeginDoc
BinaryImage
Compression
CreateWaterMark
CurrentWaterMarkIndex
DocumentInfo_Author
DocumentInfo_CreationDate
DocumentInfo_Creator
DocumentInfo_Keywords
DocumentInfo_Producer
DocumentInfo_Subject
DocumentInfo_Title
EndDoc
FileName
FlipImage
FontEmbedStyle
GenerateInMemoryFile
GetCurrentPageIndex
GetImageCount
GetImageHeight
GetImageResolution
GetImageWidth
GetUsedDC
GetUsedDCResolution
GlyphsToUnicodeStr
HDC
InitialZoom
InitialZoom2
JPEGQuality
LastError
LoadICCProfile
LogActionsAndErrors
LogTextOperation
MakeImageGrayScale
MakeImageNegative
MemoryFileSize
MetafileImagesCompressionType
MetafileImagesJpegCompression
NewPage
NonEmbeddedFonts
NonEmbeddedFonts_Add
NotEmbedAnyFonts
OnePass
OutputByteStream
OwnerPassword
PageCount
PageHeight
PageLayout
PageMode
PageNumber
PageWidth
PlaceImageToCurrentPage
PlayEMF
PrinterForVirtualDC
Printing
ProducePDFA
ProtectionEnabled
ProtectionKeyLength
ProtectionOptions_coAssembly
ProtectionOptions_coCopyInformation
ProtectionOptions_coExtractInfo
ProtectionOptions_coFillAnnotation
ProtectionOptions_coModifyAnnotation
ProtectionOptions_coModifyStructure
ProtectionOptions_coPrint
ProtectionOptions_coPrintHigh
Resolution
SetCurrentPage
SetPDFAOutputIntent
SetPDFXOutputIntent
StartEngine
SwitchedToWatermark
TransformColors
UseCurrentDocumentResolutionForNextPages
UserPassword
UseScreenDC
Version
ViewerPreferences_vpCenterWindow
ViewerPreferences_vpFitWindow
ViewerPreferences_vpHideMenuBar
ViewerPreferences_vpHideToolBar
ViewerPreferences_vpHideWindowUI
Collapse All

This method selects a specified page of the PDF document.

Syntax

HRESULT SetCurrentPage (
LONG pageIndex
)
Parameters
pageIndex
Index of the page (starts at zero and continues to the existing page count minus 1)

Return value
If successful, this method returns S_OK. If it fails, this method should return one of the error values.

Remarks

SetCurrentPage sets the current page to a new value. The PDF page index can be retrieved from the GetCurrentPageIndex method.

Equivalent in new interface: IPDFDocument4::CurrentPage.

Example

Setting the Current Page of a PDF Document

Delphi
[copy to clipboard]
{ PDF object is supposed to be created }
PDF.BeginDoc;
PDF.NewPage;
PDF.NewPage;
for i := 0 to PDF.PageCount-1 do
begin
    PDF.SetCurrentPage(i);
    PDF.PDFPAGE_SetActiveFont('Verdana', False, False, False, False, 8.0, 0);
    PDF.PDFPAGE_TextOut(100, 100, 0.0, 'Page ' + IntToStr(i + 1));
end;
PDF.EndDoc;
C/C++
[copy to clipboard]
// PDF object is supposed to be created
PDF->BeginDoc();
PDF->NewPage();
PDF->NewPage();
for (LONG i = 0; i < PDF.PageCount; i++)
{
    PDF->SetCurrentPage(i);
    PDF->PDFPAGE_SetActiveFont("Verdana", FALSE, FALSE, FALSE, FALSE, 8.0, 0);
    CString str;
    str->Format("Page %d", i + 1);
    PDF->PDFPAGE_TextOut(100, 100, 0.0, str);
}
PDF.EndDoc();
C#
[copy to clipboard]
// PDF object is supposed to be created
PDF.BeginDoc();
PDF.NewPage();
PDF.NewPage();
for (long i = 0; i < PDF.PageCount; i++)
{
    PDF.SetCurrentPage(i);
    PDF.PDFPAGE_SetActiveFont("Verdana", FALSE, FALSE, FALSE, FALSE, 8, 0);
    string str = "Page " + (i + 1).ToString();
    PDF.PDFPAGE_TextOut(100, 100, 0, str);
}
PDF.EndDoc();
Visual Basic
[copy to clipboard]
' PDF object is supposed to be created
PDF.BeginDoc
PDF.NewPage
PDF.NewPage
for i=0 to PDF.PageCount-1
    PDF.SetCurrentPage i
    PDF.PDFPAGE_SetActiveFont "Verdana", FALSE, FALSE, FALSE, FALSE, 8, 0
    PDF.PDFPAGE_TextOut 100, 100, 0, "Page " & (i + 1)
next
PDF.EndDoc

See Also

PDF Library Download Features Manual Tutorials FAQ Pricing HTML2PDF-X Pilot History In the Lab

 

 

PDF Library | Virtual Printer | Converters to PDF

Support | Blog | Forum | Contacts

© 2000-2012, Two Pilots