performance problem with dashed lines

The PDF-XChange Viewer for End Users
+++ FREE +++

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Paul - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

jpg
User
Posts: 2
Joined: Thu Apr 12, 2012 2:41 pm

performance problem with dashed lines

Post by jpg »

hello,

i'm a c# developer, and i create a pdf from a drawing containing a very simple line but with custom dash style; the pdf is done by printing the drawing with a 'pdf printer' such as pdf creator or cute pdf writer; the pdf is very small (3 KB) but takes several seconds to appear in pdf-xchange viewer (version 2.5) on a modern PC (core i5); this performance problem doesn't existe if the line is continuous.
Can you tell me what's wrong with this line ?
You do not have the required permissions to view the files attached to this post.
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19930
Joined: Mon Jan 12, 2009 8:07 am

Re: performance problem with dashed lines

Post by Stefan - PDF-XChange »

Hello jpg,

There is something wrong with this file indeed - as when I tried to open it in Adobe - I got an error message "A drawing error occurred" - and only 1/3 of your line being actually rendered by Adobe.

Please try to use a different PDF creator tool - e.g. our printing drivers:
https://www.pdf-xchange.com/product ... rivers-api
and see if this will resolve the problem.

Best,
Stefan
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3603
Joined: Thu Jul 08, 2004 10:36 pm

Re: performance problem with dashed lines

Post by Ivan - Tracker Software »

Please check you code for document creation. Dashes on the page have invalid dash offset values:

Code: Select all

[ 115.748 21.2598 9.4488 21.2598 ] 1073741760.0 d
...
[ 115.748 21.2598 9.4488 21.2598 ] -536870880.0 d
Looks like some variables were not initialized.
PDF-XChange Co Ltd. (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
jpg
User
Posts: 2
Joined: Thu Apr 12, 2012 2:41 pm

Re: performance problem with dashed lines

Post by jpg »

Thanks for your fast reply that at least enabled me to apply a quick patch to the CAD program i'm working on (producing invalid pdf was a serious bug for our clients). The patch is simply to reset the dashoffset to 0 each time i call Graphics.DrawLine; the dashstyle is therefore not 'continuous' from one segment to the next, but it's a minor bug.

Now i understand i'm here in a forum about pdf xchange viewer, not in a forum about c# programming, but perhaps, as some of you are certainly developers, can you give me a hint : if you look at the 3 segment line in the pdf i joined in my 1st post, the dash offset is normally computed before drawing each segment, so that the dashstyle is continued from one segment to the next; it works perfectly on screen, but when printing (to pdf), apparently a correcting factor is needed, i have no idea about that; and the invalid values showed in your post seem very strange to me (it's clear i never set the offset to such values).

And finally, a tool showing the 'vector' content of a pdf, such as you showed in your post, would be very helpful to developers, is it publicly available ?

(sorry for my approximative english, it's not my first langage)
Walter-Tracker Supp
User
Posts: 381
Joined: Mon Jun 13, 2011 5:10 pm

Re: performance problem with dashed lines

Post by Walter-Tracker Supp »

jpg wrote:Thanks for your fast reply that at least enabled me to apply a quick patch to the CAD program i'm working on (producing invalid pdf was a serious bug for our clients). The patch is simply to reset the dashoffset to 0 each time i call Graphics.DrawLine; the dashstyle is therefore not 'continuous' from one segment to the next, but it's a minor bug.

Now i understand i'm here in a forum about pdf xchange viewer, not in a forum about c# programming, but perhaps, as some of you are certainly developers, can you give me a hint : if you look at the 3 segment line in the pdf i joined in my 1st post, the dash offset is normally computed before drawing each segment, so that the dashstyle is continued from one segment to the next; it works perfectly on screen, but when printing (to pdf), apparently a correcting factor is needed, i have no idea about that; and the invalid values showed in your post seem very strange to me (it's clear i never set the offset to such values).

And finally, a tool showing the 'vector' content of a pdf, such as you showed in your post, would be very helpful to developers, is it publicly available ?

(sorry for my approximative english, it's not my first langage)
It's hard to say what's going on with the incorrect dash values, could be any of a number of things including buggy libraries that create them (since these are not our libraries, it is hard to say, and we are not able to provide support for other products obviously).

We have an internal (self-built) tool for analyzing PDFs, but it is not available to outside developers at the moment.


-Walter