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

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