Report Creation


peyro
 Share

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 5 years later...

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?

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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")

Link to comment
Share on other sites

  • 10 months later...
  • 2 years later...

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,

font error.png

Link to comment
Share on other sites

  • 6 months later...

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 6 months later...

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,

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

  • 1 year later...

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.

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...
  • 4 weeks later...

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share