peyro Posted March 12, 2009 Share Posted March 12, 2009 Hello, I am trying to set up a printed report that includes a set of variables, and images (panels, some buttons, etc), like doing a word file report of a production in a day. My question is if there is a way to do this in DAqfactory so I can print this out without leaving the operator screen to go to another program (word in this case). For example I saw that I can print a page, with system.printpage, so I can arrange a page with all the information I need, the problem is that there is no realtion between the size of the page screen and a letter page in the printer for example. That is, a variable display with font size of 10 looks huge in the printer with the printpage command. Any insigth on how to do this in a more easy way is welcome!! Thanks in advance Ap Quote Link to comment Share on other sites More sharing options...
AzeoTech Posted March 12, 2009 Share Posted March 12, 2009 Yeah, printpage doesn't work terribly well for this sort of thing. You are better off generating a file and then printing that file with an external application. You can trigger an external app to print by using system.shellexecute() with "print" as the action. This works on many applications. As for generating the file, the easiest is a text file using just file. functions, but you can also generate a PDF using Page.PrintPDF() That function is undocumented and doesn't work with every screen control, but should work with tables and text. The prototype is Page.PrintPDF(PageName, FileName, x, y) where PageName is a string containing the name of the page to create a PDF out of, FileName is the path to the pdf file you want to create, and x and y are not used, but should be set to 1000. Once you create the PDF you should be able to trigger a print of the PDF using shellexecute() and acrobat. Quote Link to comment Share on other sites More sharing options...
peyro Posted March 12, 2009 Author Share Posted March 12, 2009 Thanks again for the help, I will try both alternatives to see what is better... regards Ap Quote Link to comment Share on other sites More sharing options...
EOlsen Posted May 19, 2014 Share Posted May 19, 2014 Is the Page.PrintPDF() function still supposed to be working with pages with tables? I have a page with a table as the only component. When I use the function it generates a file, but when viewing the PDF file the page is blank. I calling it from the command / alert window as Page.PrintPDF("Table", "Test-1.PDF", 1000, 1000). Any suggestions? Quote Link to comment Share on other sites More sharing options...
AzeoTech Posted May 20, 2014 Share Posted May 20, 2014 Your scaling is wrong. It should basically be in inches, so: page.printPDF("Table", "Test-1.pdf", 8.5, 11) That functionality has changed since this original post from 2009. Quote Link to comment Share on other sites More sharing options...
EOlsen Posted May 20, 2014 Share Posted May 20, 2014 Yes, using inches puts the table in the PDF. But there is a problem if the contents of the last cell exceed the width of the cell, part of the contents is displayed past the right edge of the table, part is masked by the vertical scroll bar, and part appears to wrap around and overlay the beginning of the cell. Also the PDF only includes what is showing on the display and not the entire table. Could temporarily resize the table, but what happens if the table is really long - say 500 hundred or more rows. Are there limits to how big you can make the vertical dimensions of the table without running into problems? And in this case what would you want to use as size parameters for the printPDF function? Quote Link to comment Share on other sites More sharing options...
AzeoTech Posted May 20, 2014 Share Posted May 20, 2014 DAQFactory doesn't do automatic pagination. You can, however, extend your table off the screen and it will still print that area. The problem is that if you make the table too long, the aspect is going to get weird and table is going to get really long and thin. I personally create a separate report page when I have components off the side of the screen. If you want a multipage report you are going to have to do it manually. This only works in 5.90.7 and newer. Create a table that is the right aspect for one page, filled just with the data for that page. First call page.pdfStart(). It takes just the aspect, so is usually: page.pdfStart(8.5, 11) Then, to actually "print" a page to the pdf, setup the page and call: page.pdfAddPage("myPageName") repeat this, updating the data in your table for each page and then calling addPage(). When you are done, call pdfFinish() with the path: page.pdfFinish("c:\daqfactory\myReport.pdf") It would actually be very easy to do. For example, lets say you have a table with just one column containing the array "data". You size the table so it prints a single page nicely. Feel free to add other components that printPDF supports. Then figure out how many rows of the table are visible so the scroll bar doesn't show. Then, change the Expression in the table to: data[tableStart, tableStart + tableLength] where tableStart is a global variable, and tableLength is the # of rows visible on the table (make it a global too...). Finally a short sequence will get you there: global tableLength = 50 page.pdfStart(8.5,11) tableStart = 0 while(tableStart < numrows(data)) page.pdfAddPage("myReportPage") tableStart += tableLength endwhile page.pdfFinish("c:\myReport.pdf") Quote Link to comment Share on other sites More sharing options...
AzeoTech Posted April 2, 2015 Share Posted April 2, 2015 Here's an example file. multiPagePDF.ctl Quote Link to comment Share on other sites More sharing options...
matanu Posted May 31, 2017 Share Posted May 31, 2017 Hi Guru, I use Vietnamese to write program, it displays properly in DAQFactory. But when I create pdf report file using ( page.printPDF function), the font went wrong as the picture. Please advice me solution to solve this case. Thank you, Quote Link to comment Share on other sites More sharing options...
AzeoTech Posted May 31, 2017 Share Posted May 31, 2017 Unfortunately the PDF generator in DAQFactory is limited in its font selection and so can't display some foreign characters. You may have to make the text into a graphic instead. Quote Link to comment Share on other sites More sharing options...
boliva Posted December 29, 2017 Share Posted December 29, 2017 Is there a way to change a variable value text on screen to a graphic for printPDF? Basically, I want some characters bold, but I can't seem to get printPDF to print bold characters. I tried changing the font used, but it always appears with the same font and nothing is bold...UNLESS there's a specific font that I SHOULD be using that will display bold characters in the final pdf created using the command or there is a switch that I should be using in the command to accomplish this? Quote Link to comment Share on other sites More sharing options...
AzeoTech Posted December 30, 2017 Share Posted December 30, 2017 No, unfortunately as mentioned, the PDF generator doesn't dump any font information into the PDF. You are the second person recently to ask about foreign characters and fonts in PDFs. You should post a request in the feature request part of the forum and we'll see what we can do. In the meantime you have several choices: 1) use the Acrobat Distiller (print driver) and Print the page instead of using the printPDF() function. 2) try doubling up the component and shifting it by one pixel. This will give the illusion of bold, but also might make it unreadable. Its worth a try though. Quote Link to comment Share on other sites More sharing options...
moheb Posted July 2, 2018 Share Posted July 2, 2018 I have same problem . i use Arabic characters,when I create pdf report file using ( page.printPDF function), the font went wrong or not appear when I use printpage function . in issue 5.79 it work correctly but when I use it with issue 5.91 variables appear in corner of page printing report is so important so I wish to have solution except printing page as picture , it not perfect Thank you, Quote Link to comment Share on other sites More sharing options...
AzeoTech Posted July 2, 2018 Share Posted July 2, 2018 Unfortunately you will almost certainly have to use the Acrobat Distiller and printPage. If you are having problems with printing the page, you might need the latest build. Please email us directly and we can provide you with a beta. It does printing a lot better than older releases. Quote Link to comment Share on other sites More sharing options...
kanber Posted January 13, 2020 Share Posted January 13, 2020 Hi, I am using version 18.1 Build 2347. Is there still characters problem for ş,ç etc. I have problem with convert to pdf file a table with a lot of pages. I need to use pdfAddPage function. But on pdf is is not chowing ş,ç etc characters. I should do that for take report from system. Quote Link to comment Share on other sites More sharing options...
kanber Posted January 16, 2020 Share Posted January 16, 2020 Also how can I set on "page.pdfFinish" function to make pdf pages horizontal. It is converting to pdf with vertical Quote Link to comment Share on other sites More sharing options...
AzeoTech Posted January 30, 2020 Share Posted January 30, 2020 The orientation is determined in the pdfStart() numbers. It is x and y, so if x is smaller than y, it will be portrait. Quote Link to comment Share on other sites More sharing options...
kanber Posted February 13, 2020 Share Posted February 13, 2020 Is here any update for ç,ş,ğ etc. characters for converting pdf file since 2018? Quote Link to comment Share on other sites More sharing options...
AzeoTech Posted March 10, 2020 Share Posted March 10, 2020 No, if PrintPDF() doesn't do what you want, you'll have to use a 3rd party PDF generating tool like Acrobat Distiller and print to it. I recommend at least 17.1 for this as it scales better. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.