Invisible printing with DynaPDFMBS

I was asked to update a quote/sales order/invoicing program I wrote in 2017 so that it would print on two pages if necessary. The quotes, etc consist of a heading section, a DynaPDFTableMBS that contains all the items to be sold, and a footer section with links to terms & conditions, product data sheet and installation manuals. The first part was easy, just before the database looped to the next record, I added

if y> 720.0 Then // height of pdf
call tbl.DrawTable(35.0, y, 742.0-y)
call pdf.EndPage
call pdf.Append
y= 50
end if

It works fine. At a certain point, one or more of the links at the bottom don’t print so I added this after the tbl.DrawTable command.

if y> 570 Then
call pdf.EndPage
call pdf.Append
y= 50
end if

After adjusting the number of rows to be printed so that the links should be printed at the top of the second page, I found the second page to be blank. But clicking on random blank spots on the second page causes the pdf viewer to display the links. It appears the printing is invisible (or white). If even one row of the table prints on the second page, everything is OK.

Is that a recent DynaPDF Plugin from us?

Can you reproduce this in a sample project?

Do you have code in PageBreak event?
Or maybe otherwise reset the drawing color?

It is the March 8, 2016 version of MBS DynaPDF running under API 1 (Xojo 2019r1.1). Same as the original written in 2017.

There is nothing in PageBreak
There is nothing to change the drawing color

If I comment out the second code snippet above, it will print the first three links on the first page with the last one being lost.

I will see if I can come up with a sample project. The whole project is huge and I don’t want to try to update to API 2.

You don’t need to do API upgrades.
But you could update the plugin to check if current version works better.

I don’t like chasing for a bug, which may have been fixed in the last 6 years.

1 Like

Are you using the table’s .havemore property to determine if there is a need for the second page?

while table.HaveMore
    call pdf.endpage
   // WriteErrLog "Endpage  failed"
  end try
  call pdf.Append
  //SetPageSize  pdf, nPDFPageSize
  df_endpositionoftable  =  table.DrawTable( df_leftoffset, df_startposition, df_usableheight ) 

This works fine for me.
You could try setting font and text color after the .Append, although the table has it’s own properties for that.

Jeff Tullin

Are you using the table’s .havemore property to determine if there is a need for the second page?

The problem only happens after I am finished with the table. I have not been able to find a way to set the text color after searching the docs for TextColor. Perhaps it was not available in the 2016 version of dynaPDFMBS. I see if for things like dynaPDFFieldExMBS but not for the main module.

Well, I would expect it is something after the page break in the wrong state.

You can of course set StrokeColor or FillColor, but maybe first upgrade the DynaPDF version.

You dont need to ‘upgrade’ to API2

Download the MBS plugins, duplicate your existing plugins folder, replace the old plugins with the new, and try the new ones in demo mode.
If it works, consider upgrading the plugins.

if it still doesn’t work, then as Christian says, follow your .append with

call pdf.SetStrokeColor &c000000 
call pdf.SetFillColor &c000000

Setting stroke and fill colors didn’t help.

When I replaced the old DynaPDFMBS plugin with the new one, my CubeSQL plugin stopped working saying SQLSelect was not a valid command recognized by the plugin.

The sales guy who pointed out the problem with needing two pages says the only time he needs that is for orders from distributors and they don’t need the links to the manuals so don’t worry about it if they don’t work properly. Case closed. Thanks to Jeff and Christian for looking into this.

Still use the same version of Xojo but ONLY replace the DynaPDFMBS plugin. That will get rid of that error… The DynaPDF plugin itself does not reference DB stuff.

  • Karen
1 Like

That is exactly what I did. Restoring the old version of DynaPDFMBS fixed the problem. Thought it was interesting, but not something I am going to spend any time on.