1. Kevin Thai
  2. PowerBuilder
  3. Wednesday, 30 January 2019 19:24 PM UTC

Hi all,

 

I am trying to learn the settings for the NativePDF exporter. Here is the code I am using: 

 

dw_print.Object.DataWindow.Export.PDF.NativePDF.UsePrintSpec = 'Yes'
dw_print.Object.DataWindow.Export.PDF.Method = NativePDF!
dw_print.Object.DataWindow.Print.Paper.Size = 1 //1 – Letter 8 1/2 x 11 in
dw_print.Object.DataWindow.Export.PDF.NativePDF.MasterPassword = '123'
dw_print.SaveAs([filename], PDF!, true)

When I set MasterPassword it locks the ability to print the document without password. Is there a way to set it so the user can print the document without needing the password, but editing and copy are still locked?

 

Appreciate your help!

Accepted Answer
Kevin Thai Accepted Answer Pending Moderation
  1. Wednesday, 30 January 2019 20:29 PM UTC
  2. PowerBuilder
  3. # Permalink

Edit:

 

Thanks to Mike S. this works just put in the wrong datawindow.

 

I did try setting restrictions like so :

dw_print.Object.DataWindow.Export.PDF.NativePDF.UsePrintSpec = 'Yes'
dw_print.Object.DataWindow.Export.PDF.Method = NativePDF!
dw_print.Object.DataWindow.Print.Paper.Size = 1 
dw_print.Object.DataWindow.Export.PDF.NativePDF.MasterPassword = '123'
dw_1.Object.DataWindow.Export.PDF.NativePDF.Restrictions = 'nomodify!,nocopy!'

Still cannot print.

Also tried saving the PDF without Restrictions and it still did not let me print it. So I assumed it had to do with the Masterpassword.

Comment
  1. mike S
  2. Wednesday, 30 January 2019 20:47 PM UTC
dw_1 OR dw_print? You used dw_1 for the restrictions and dw_print for the others....



it works fine for me ( i can print). what version of PB are you running?



i use modify instead of dot notation, and all in one:



dw.Modify("DataWindow.Export.PDF.NativePDF.MasterPassword = '123' DataWindow.Export.PDF.NativePDF.Restrictions = 'nomodify!,nocopy!' ")





  1. Helpful
  1. Kevin Thai
  2. Wednesday, 30 January 2019 20:54 PM UTC
Welp, did not notice I put dw_1 instead of dw_print. Thanks for your help works for me.
  1. Helpful
There are no comments made yet.
mike S Accepted Answer Pending Moderation
  1. Wednesday, 30 January 2019 20:23 PM UTC
  2. PowerBuilder
  3. # 1
did you set the restrictions?

from the help:



"DataWindow.Export.PDF.NativePDF.Restrictions { = 'value' }"

 

Parameter

Description

value

(exp) The password for opening the generated PDF file.

The value can be a string containing one or more of the following values (separated by ","):

  • noprint! - Acrobat will prevent printing the file.

  • nohiresprint! - Acrobat will prevent high-resolution printing. If noprint is not 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! - (Deprecated in PDF 2.0; not allowed in PDF/UA-1) Acrobat will prevent extracting text or graphics for accessibility

  • plainmetadata! - (PDF 1.5) Keep XMP document metadata unencrypted even in an encrypted document.

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.