RTPDF-32
PDF Generator Library for RTOS-32
X:/Projects.6.0.0/PdfPrint/RTPDF-32/RTPDF-32.h

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
// 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.
// //
// Amyuni RTPDF-32 - PDF Library for On Time RTOS-32 //
// //
// Copyright AMYUNI Lda. - AMYUNI Technologies //
// 1998-2021, All Rights Reserved ***** CONFIDENTIAL ***** //
// //
// Permission to use this work for any purpose must be expressly obtained //
// from: AMYUNI Technologies, https://www.amyuni.com, management@amyuni.com //
// //
//
#pragma once
#ifdef __cplusplus
extern "C"
{
#endif
#ifndef RTPDF // defined when called from within the library
typedef void* LPPDFINFO;
typedef void* HANDLE;
#endif
#include "RTPDF-DDI.h"
void RTPdfEnd(LPPDFINFO pdev);
int RTPdfSetLicenseKey(LPPDFINFO pdev, const char *szLicensee, const char *szKey, int nKeyLen);
void RTPdfSetDrawingOrigin(LPPDFINFO pdev, long lXOrg, long lYOrg);
typedef enum _DocumentInfo
{
int RTPdfSetDocumentInfo(LPPDFINFO pdev, DocumentInfo nDocumentInfo, const BYTE *szEntryValue);
int RTPdfSetLayer(LPPDFINFO pdev, PWSTR pwstrLayerTitle);
HANDLE RTPdfOpenPort(const char *szDocTitle, const unsigned long dwJobId);
int RTPdfWritePort(HANDLE hPort, const unsigned char* pData, unsigned long *pdwDataSize);
int RTPdfClosePort(HANDLE hPort, int bCancel);
#ifndef RTPDF
{
return 0;
}
#endif
HANDLE RTPdfGetFont(LPPDFINFO pdev, const char *szFontName, int bBold, int bItalic, int nCodePage, int bType1, int bCID);
int RTPdfSetFont(LPPDFINFO pdev, HANDLE hFont, float fPointSize);
int RTPdfSetTextSpacing(LPPDFINFO pdev, long lWordSpacing, long lCharSpacing);
int RTPdfTextOut(LPPDFINFO pdev, CLIPOBJ *pco, BRUSHOBJ *pboText, long lPosX, long lPosY, float fAngle, const BYTE *pbCharCodes, int nCharCount, int nEncoding);
float RTPdfGetTextWidth(HANDLE hFont, float fPointSize, const BYTE *pbCharCodes, int nCharCount, int nEncoding);
int RTPdfDrawText(LPPDFINFO pdev, RECT rcText, UINT nTextAlign, int bClipToBoundaries, COLORREF crTextColor, const BYTE *pbCharCodes, int nCharCount, int nEncoding);
HANDLE RTPdfGetImage(LPPDFINFO pdev, const BYTE *pbImageData, unsigned long ulImageSize);
int RTPdfDrawImage(LPPDFINFO pdev, CLIPOBJ *pco, HANDLE hImage, long lStartX, long lStartY, long lWidth, long lHeight, int bKeepAspectRatio);
// fill and stoke values available for RTPdfStrokeAndFillPath::flOptions
#define PDF_PATH_NONE 0
#define PDF_PATH_STROKE 1
#define PDF_PATH_FILL 2
#define PDF_PATH_FILLANDSTROKE 3
#define PDF_PATH_FILL_WINDING 8
BRUSHOBJ *pboStroke, PLINEATTRS plineattrs,
BRUSHOBJ *pboFill, PPOINTL pptlBrushOrg, ULONG mix, FLONG flOptions);
#ifdef __cplusplus
}
#endif
void * LPPDFINFO
Definition: RTPDF-32.h:21
void RTPdfEnd(LPPDFINFO pdev)
Clear all memory allocated while creating a PDF file and free the PDFINFO structure.
LPPDFINFO RTPdfInit()
Allocate memory and initialize a PDFINFO structure.
int RTPdfClosePort(HANDLE hPort, int bCancel)
Close the file or port that was opened in RTPdfOpenPort.
int RTPdfSetFont(LPPDFINFO pdev, HANDLE hFont, float fPointSize)
Set the font to be used in all text drawing operations after this function is called.
float RTPdfGetTextWidth(HANDLE hFont, float fPointSize, const BYTE *pbCharCodes, int nCharCount, int nEncoding)
Get width of a text string given the font name and size.
HANDLE RTPdfGetFont(LPPDFINFO pdev, const char *szFontName, int bBold, int bItalic, int nCodePage, int bType1, int bCID)
Create a PDF font object and return a handle that can be used to render text on a page RTPdfStartDoc ...
int RTPdfDrawText(LPPDFINFO pdev, RECT rcText, UINT nTextAlign, int bClipToBoundaries, COLORREF crTextColor, const BYTE *pbCharCodes, int nCharCount, int nEncoding)
Draw text given a bounding rectangle.
int IsMetricCountry()
This function is used to set the default paper size to Letter or A4 By default RTPDF-32 attempts to r...
Definition: RTPDF-32.h:312
void RTPdfSetDrawingOrigin(LPPDFINFO pdev, long lXOrg, long lYOrg)
Shift all drawing operations by a certain distance To reset the origin, call the same function with o...
PATHOBJ * RTPdfCreatePath(LPPDFINFO pdev)
Create a path object made of lines and curves to be used in all vector drawing operations See PATHOB...
int RTPdfSetDocumentInfo(LPPDFINFO pdev, DocumentInfo nDocumentInfo, const BYTE *szEntryValue)
Set a document information attribute (also known as Metadata) The attributes should be set before ca...
int RTPdfTextOut(LPPDFINFO pdev, CLIPOBJ *pco, BRUSHOBJ *pboText, long lPosX, long lPosY, float fAngle, const BYTE *pbCharCodes, int nCharCount, int nEncoding)
HANDLE RTPdfGetImage(LPPDFINFO pdev, const BYTE *pbImageData, unsigned long ulImageSize)
Output an image object to the PDF stream without yet drawing any image BMP, JPeg and PNG images are c...
enum _DocumentInfo DocumentInfo
Enumeration of the various document info attributes that can be used in RTPdfSetDocumentInfo.
int RTPdfSetLicenseKey(LPPDFINFO pdev, const char *szLicensee, const char *szKey, int nKeyLen)
Set the License Key for the library. The license key contains specific licensed features and the libr...
int RTPdfDrawImage(LPPDFINFO pdev, CLIPOBJ *pco, HANDLE hImage, long lStartX, long lStartY, long lWidth, long lHeight, int bKeepAspectRatio)
Draw a preloaded image to a specific location on a page All units should be provided in PDF units whe...
_DocumentInfo
Enumeration of the various document info attributes that can be used in RTPdfSetDocumentInfo.
Definition: RTPDF-32.h:147
@ DocumentInfoTitle
Definition: RTPDF-32.h:148
@ DocumentInfoSubject
Definition: RTPDF-32.h:151
@ DocumentInfoKeywords
Definition: RTPDF-32.h:152
@ DocumentInfoCreator
Definition: RTPDF-32.h:150
@ DocumentInfoAuthor
Definition: RTPDF-32.h:149
int RTPdfWritePort(HANDLE hPort, const unsigned char *pData, unsigned long *pdwDataSize)
Write a block of data to the specified file or port.
int RTPdfSetTextSpacing(LPPDFINFO pdev, long lWordSpacing, long lCharSpacing)
Set the Word and Character spacing of any text drawn after this function is called.
void * HANDLE
Definition: RTPDF-32.h:22
int RTPdfEndDoc(LPPDFINFO pdev)
End the current document, no output is allowed after this call.
int RTPdfEndPage(LPPDFINFO pdev)
End the current page.
void RTPdfDeletePath(PATHOBJ *ppo)
Delete the path object created through RTPdfCreatePath.
HANDLE RTPdfOpenPort(const char *szDocTitle, const unsigned long dwJobId)
Allows the caller to create a file or open a port to where the PDF data is sent.
int RTPdfStrokeAndFillPath(LPPDFINFO pdev, PATHOBJ *ppo, CLIPOBJ *pco, BRUSHOBJ *pboStroke, PLINEATTRS plineattrs, BRUSHOBJ *pboFill, PPOINTL pptlBrushOrg, ULONG mix, FLONG flOptions)
Draw a path object made of straight lines and/or Bezier curves If requested, also fill the path using...
Definition: RTPDF-DDI.h:88
Definition: RTPDF-DDI.h:104
Definition: RTPDF-DDI.h:57
Definition: RTPDF-DDI.h:82