Tech Articles


PDF Enhancements in PowerBuilder 2017 R3


With the release of PowerBuilder 2017 a new native method of exporting DataWindows to PDF became available.  There were some enhancements to that functionality added in R2 and in R3 that we're going to look at in this article.

The R2 enhancements were more minor, but one of them (PDFStandard) becomes important when looking at the R3 enhancements.  R2 added the following new DataWindow properties.

Export.PDF.NativePDF.ImageFormat 0 - (Default) BMP
1 - JPG
2 - PNG
3 - GIF
Export.PDF.NativePDF.PDFStandard 0 - None
1 - PDF/A-1a
2 - PDF/A-1b
3 - PDF/A-3a
4 - PDF/A-3b
5 - PDF/A-3u
Export.PDF.NativePDF.UsePrintSpec Yes - Use the settings in the Print Specifications page or in the Print.Orientation and Print.Paper.Size properties.No - (Default) Use the settings in the Data Export page or in the Export.PDF.NativePDF.CustomOrientation and Export.PDF.NativePDF.CustomSize properties.

At the time, I wasn't impressed enough with those features to create a blog post for them. However, with R3, the following additional enhancements have also been added, and these I did find interesting enough to write up.

Export.PDF.NativePDF.UserPassword Set a password for opening the generated PDF file
Export.PDF.NativePDF.MasterPassword Set a password for the administration permissions -- print, copy, edit, etc. -- to the generated PDF file
Export.PDF.NativePDF.Restrictions Set the permissions (including copying/printing/editing) of the generated PDF file. One more more of the following separated by commasnoprint! - Acrobat will prevent printing the file.nohiresprint! - Acrobat will prevent high-resolution printing. If noprint isn't set, printing is restricted to the print as image feature which prints a low-resolution rendition of the page.nomodify! - Acrobat will prevent editing or cropping pages and creating or changing form fields.noassemble! - Acrobat will prevent inserting, deleting, or rotating pages and creating bookmarks and thumbnails.noannots! - Acrobat will prevent creating or changing annotations and form fields.noforms! - Acrobat will prevent form field filling (implies nomodify and noannots).nocopy! - Acrobat will prevent copying and extracting text or graphics; the accessibility interface will be controlled by noaccessible.noaccessible! - Acrobat will prevent extracting text or graphics for accessibility (Deprecated in PDF 2.0; not allowed in PDF/UA-1).plainmetadata! - Keep XMP document metadata unencrypted even in an encrypted document (PDF 1.5).
SaveNativePDFToBlob function Saves the PDF source into a blob variable

Passwords

If you set a user password you must set a master password as well, and they can't be the same.  If you set a user password the user will be prompted to enter a password when they attempt to open the document.  For example, in Adobe Acrobat you see this:

And if you used the Firefox browser you would see this:

Restrictions

A master password is also required if you want to set restrictions on what the user can do with the document, regardless of whether or not you apply a user password.  When the restrictions are in place, the options needed to perform those actions are disabled in the PDF viewer.  In Adobe Acrobat, you can view the security settings on a document to see what has been disabled.

Note that in order to use the new R3 features the print specification must be left at the default of None or set to it.  The other print specifications (PDF/A) are s subset of the full PDF standard and don't support these options.

SaveNativePDFToBlob

The SaveNativePDFToBlob method allows you to get the PDF source without writing it out to a file and then reading the file.  The primary use would be in a service that streams the PDF content to a web client.

Summary

2017 R2 and R3 add a number of important options to PDF generation, in particular allow you to protect documents and stream documents without having to save to an intermediate file.

 

Comments (0)
There are no comments posted here yet

Find Articles by Tag

JSONGenerator Debugger UI Themes CrypterObject Graph License Database Table Schema Service Azure TFS C# Database Painter PBDOM File Visual Studio Source Control PFC OAuth Variable Deployment Script SVN PowerBuilder Compiler COM Export Resize Git Window DataType SqlExecutor Stored Procedure Database Table Data DataWindow Source Code OLE SOAP Testing InfoMaker Array Event Handling ODBC PDF PBVM DLL SnapObjects JSONParser RibbonBar ActiveX UI Modernization PowerBuilder (Appeon) SDK XML Icon Database Table Repository Data TLS/SSL RichTextEdit Control Menu Windows 10 Icons RibbonBar Builder Linux OS Charts Event .NET Assembly Database Object Web Service Proxy Installation Excel PostgreSQL PDFlib Trial DragDrop Jenkins Expression SnapDevelop Oracle MessageBox Migration Text Configuration Validation Authorization SqlModelMapper Bug JSON PowerScript (PS) API Application Class Sort Elevate Conference Export JSON Open Source TortoiseGit Outlook Interface CI/CD OAuth 2.0 BLOB Authentication NativePDF PowerServer Web Debug SQL PowerBuilder Messagging PowerServer Mobile GhostScript Mobile Syntax .NET Std Framework Import Transaction CoderObject .NET DataStore Database Debugging Web API Platform WebBrowser Android OrcaScript Design RESTClient DevOps DataWindow JSON 32-bit Model PBNI Filter SQL Server Automated Testing Encryption Windows OS Performance HTTPClient Database Connection 64-bit iOS PostgreSQL ODBC driver WinAPI IDE Event Handler TreeView UI Branch & Merge Error Database Profile Import JSON External Functions REST Encoding