RTPDF-32
PDF Generator Library for RTOS-32
Sample

Srart of End a PDF layer on which to place the next objects

Parameters
pdevPointer to PDFINFO structure returned by RTPdfInit
pwstrLayerTitlecan be one of three things: 1) If RTPdfSetLayer is called inside a page (between calls to StartPage and EndPage), pwstrLayerTitle is the title of the layer on which to place the objects 2) If RTPdfSetLayer is called outside a page, pwstrLayerTitle should contain the list and order in which to display the layer tree in a PDF viewer. The order should be a string in the format "/Order[(Layer Title 1)(Layer Title 2)(...)]" for a single level tree of layers Or "/Order[(Layer Title 1)[(Layer Subtitle 1)(Layer Subtitle 2)(...)](Layer Title 2)[(Layer Subtitle 21)(Layer Subtitle 22)(...)]]" for a multi-level tree of layers 3) If pwstrLayerTitle is an empty string, it closes the last opened layer and moves up one level
Returns
int a negative value if an error occurs. When successful, returns the level of the layer in a multi-level tree of layers, this allows to properly close all the layers Code
// set document information before starting the document
SetDocumentInfoTest(pdev);
RTPdfSetLayer(pdev, L"/Order[(Clipped Polygons)[(Clipped Polygons - 1)(Clipped Polygons - 2)](Some Text)]");
if (!RTPdfStartDoc(pdev))
{
...
}
// output first page
// place the next polygon in a PDF layer named "Clipped Polygons - 1" under "Clipped Polygons"
RTPdfSetLayer(pdev, L"Clipped Polygons");
RTPdfSetLayer(pdev, L"Clipped Polygons - 1");
// output some polygons
DrawPolygonTest(pdev);
// end previous layers
RTPdfSetLayer(pdev, L"");
RTPdfSetLayer(pdev, L"");
int RTPdfStartDoc(LPPDFINFO pdev)
Start a new PDF document.
int RTPdfSetLayer(LPPDFINFO pdev, PWSTR pwstrLayerTitle)
int RTPdfStartPage(LPPDFINFO pdev)
Start a new page, should be called after a call to RTPdfStartDoc and before a new page is started.