We are currently trying to generate PDFs using Forms instead of multiple direct draw calls on PageContent. We want to draw a single Form and then use transforms (scale and translate) with DrawForm() to stamp/tile a pattern on the PDF.
This technique generates the desired results in most PDF viewers but has severe rendering issues in other viewers. The most problematic being the PDF rendering in the Chrome Browser and the Google Drive PDF View application on Android. Different artifacts appear in Inkscape as well.
The FormTiling.pdf attachment was generated using the above technique and the DirectDraw.pdf was created with multiple direct StrokePath() calls on PageContent.
Open FormTiling.pdf in Google Chrome or the Google Drive PDF View application on Android and Zoom in and out to see the rendering issues. Compare to DirectDraw.pdf, which has no issues.
Is there a way to flatten the added Forms as if they were direct draw calls?
But... a lot of Google's Android viewers render it incorrectly as well. Given the elevated status of Chrome and Google PDF rendering on Android, is there anything that can be done on your end (e.g. some sort of form flattening?)?
i tested following code to generate grid as each form, and using Chrome open fine.
private DocForm new_form_grid()
DocForm form = m_doc.NewForm();
PageContent cs = new PageContent();
Path path = new Path();//just draw a rectangle, bounding form area.
form.SetContent(cs, 0, 0, 32, 32);
private void test_grid(Page page)
DocForm dform = new_form_grid();
ResForm rform = page.AddResForm(dform);
PageContent content = new PageContent();
content.Create();//create content, do not forget.
float y = 0;
while(y < 800)
float x = 0;
while(x < 600)
Matrix mat = new Matrix(10.0f/32, 10.0f/32, x, y);
content.DrawForm(rform);//repeat draw this form.
x += 10;
y += 10;
i think u'd better to avoid to set very short line, chrome may not work perfectly.
i saw your form draw scan line with x delta 1, it is too small i think.
as i saw, u draw a line from (0, 95) to (1, 95)