1. Larry Langford
  2. PowerBuilder
  3. Monday, 18 June 2018 15:23 PM UTC

I'm having an issue creating PDF files from a deployed application.  I'm using NativePDF! as the file type and have included PBPDF170.dll with the runtime objects visible to the application.  However, the SaveAs operation doesn't build the .pdf file.  I've substituted saving a text file (which works) to make sure there isn't a rights issue.  I'm able to successfully save the .pdf file when I run from the development environment.  Is there something I'm missing?

The PowerBuilder Universal Version is 2017 R2 Build 1769

Larry Langford Accepted Answer Pending Moderation
  1. Tuesday, 19 June 2018 17:29 PM UTC
  2. PowerBuilder
  3. # 1

Thanks for all the help guys!  I now have the PDF save functioning properly.

Comment
There are no comments made yet.
Clarence Chamorro Accepted Answer Pending Moderation
  1. Tuesday, 19 June 2018 17:15 PM UTC
  2. PowerBuilder
  3. # 2
Here the code I used to apply the SaveAs Pdf functionality:
 
 
IF MESSAGEBOX('Save As PDF...','Do you want to SaveAs PDF:',question!,yesno!) = 2 THEN
RETURN
END IF
 
integer li_ret
string ls_projname, ls_projnum
//cch checking if there is data to convert if not just send a message
IF dw_4.rowcount() > 0 THEN
//cch construct the name of the PDF file
IF ISNULL(tab_1.tabpage_1.dw_1.object.bid_number[1]) OR TRIM(tab_1.tabpage_1.dw_1.object.bid_number[1]) = '' THEN
ls_projnum = 'No Name'
ELSE
ls_projnum = 'Proposal ' + TRIM(tab_1.tabpage_1.dw_1.object.bid_number[1])
END IF
ls_projname = trim(gstr_gen.map_padth)+ls_projnum+'.PDF'
dw_4.object.DataWindow.Export.PDF.Method = NativePDF!
//dw_4.Object.DataWindow.Export.PDF.NativePDF.ImageFormat = '1' //JPG
 
//===============
//cch call the SaveAs with PDF format
li_ret = dw_4.SaveAs(ls_projname, PDF!, True)
//cch check if the SaveAs was success or not
if li_ret = 1 then
//success
MESSAGEBOX('Save As PDF...','File was Generated as PDF.~rFile location: '+ls_projname)
Return
else
MESSAGEBOX('Save As PDF...','File was No Generated ~r' + String(li_ret))
Return
//...
end if
ELSE
MESSAGEBOX('Save As PDF...','There is no data to Save.~rError:.' + String(li_ret))
END IF
 
Also you have to consider if the name of the file has invalid caracters the file will not be created.
 
Hope this will help you.
 
Clarence.
Comment
  1. Kim Berghall
  2. Tuesday, 19 June 2018 19:11 PM UTC
dw_4.object.DataWindow.Export.PDF.Method = '2'

  1. Helpful
There are no comments made yet.
Armeen Mazda @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 19 June 2018 10:59 AM UTC
  2. PowerBuilder
  3. # 3

Just an FYI, PB 2017 R3, which will be releasing in about 6 weeks has all sorts of great enhancements to the native PDF feature: https://www.appeon.com/developers/roadmap/further-enhancing-native-pdf.html

Comment
There are no comments made yet.
Larry Langford Accepted Answer Pending Moderation
  1. Monday, 18 June 2018 15:52 PM UTC
  2. PowerBuilder
  3. # 4

The PowerBuilder Universal Version is 2017 R2 Build 1769

Comment
  1. Larry Langford
  2. Monday, 18 June 2018 22:32 PM UTC
Hey Chris!  Undoubtedly my problem is with the pb.ini.  I'm setting the properties for NativePDF! in both the DWO and explicitly by script just to make sure that isn't a problem.  I didn't include a pb.ini with my runtime objects.  What sections of the pb.ini are relevant to the .pdf process? 

  1. Helpful
  1. Kim Berghall
  2. Monday, 18 June 2018 23:22 PM UTC
You don't need to include a pb.ini file, at least we are not including it and it works just fine without it.

  1. Helpful
  1. Chris Pollach @Appeon
  2. Tuesday, 19 June 2018 13:21 PM UTC
Hi Larry;



   If you are solely relying on the PB.ini settings to turn on the NativePDF feature in your App's, then you have to make sure that a) your PB IDE's PB.ini file and your App's local PB.ini file have the following section & statements ...



[Data Window]

; 1 = Use Native, 0 = GhostScript or XLSFO

NativePDF_Valid=1

; 1 = Embed fonts in PDF, 0 = Do not embed fonts in PDF

NativePDF_IncludeCustomFont=1



 



Note that the IDE's PB.ini is located in the Windows path:  "C:\Users\\AppData\Local\Appeon\PowerBuilder 17.0"



HTH



Regards ... Chris

  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Monday, 18 June 2018 15:33 PM UTC
  2. PowerBuilder
  3. # 5

Hi Larry;

  There were some fixes to the NativePDF feature in PB2017R2.

What version and build of PB2017 are you running?

Regards ... Chris

Comment
  1. Larry Langford
  2. Monday, 18 June 2018 15:40 PM UTC
Thanks for the response Chris!  I running Version 2017 R2 Build 1769

  1. Helpful
  1. Larry Langford
  2. Monday, 18 June 2018 15:41 PM UTC
Thanks for the response Chris!  I running Version 2017 R2 Build 1769

  1. Helpful
  1. Chris Pollach @Appeon
  2. Monday, 18 June 2018 15:48 PM UTC
You should be good on that build for sure!





Are you setting the Native PDF feature within the DWO (aka DW Painter) or via PowerScript st run-time?

Also, are you using a PB.INI file that you are deploying to the App EXE's folder?



  1. Helpful
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.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.