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

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