Form rendering issues with transforms - RadaeePDF.com
Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
13 Jul 2017
Microsoft has ended support for Windows Phone 8.1
Read More...
Here you should submit your bug reports with logcat.
  • Page:
  • 1

TOPIC: Form rendering issues with transforms

Form rendering issues with transforms 2 years 9 months ago #10081

  • alenz316
  • alenz316's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 9
  • Thank you received: 0
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?

For some reason it won't let me attach any files, here are the Dropbox links:
FormTiling.pdf
DirectDraw.pdf

Please Log in or Create an account to join the conversation.

Last edit: by alenz316.

Form rendering issues with transforms 2 years 9 months ago #10119

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 846
  • Karma: 43
  • Thank you received: 12
are u mean there has some rendering issue for Chrome Browser?

Please Log in or Create an account to join the conversation.

Form rendering issues with transforms 2 years 9 months ago #10176

  • alenz316
  • alenz316's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 9
  • Thank you received: 0
Yeah there is a rendering issue with Chrome. I filed an issue for it already code.google.com/p/chromium/issues/detail?id=579720

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

Please Log in or Create an account to join the conversation.

Form rendering issues with transforms 2 years 9 months ago #10182

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 846
  • Karma: 43
  • Thank you received: 12
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();
        cs.Create();
        cs.SetStrokeColor(0xffc6deff);
        cs.SetStrokeWidth(1);
        Path path = new Path();//just draw a rectangle, bounding form area.
        path.MoveTo(0, 0);
        path.LineTo(32, 0);
        path.LineTo(32,32);
        path.LineTo(0, 32);
        path.ClosePath();
        cs.StrokePath(path);
        path.Destroy();
        form.SetContent(cs, 0, 0, 32, 32);
        cs.Destroy();
        return form;
    }

    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.GSSave();
                content.GSSetMatrix(mat);
                content.DrawForm(rform);//repeat draw this form.
                content.GSRestore();
                x += 10;
            }
            y += 10;
        }
        page.AddContent(content, true);
        content.Destroy();
    }
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)
The following user(s) said Thank You: alenz316

Please Log in or Create an account to join the conversation.

Form rendering issues with transforms 2 years 9 months ago #10213

  • alenz316
  • alenz316's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 9
  • Thank you received: 0
Changing from (0, 95) to (1, 95) to (0, 95) to (95, 95) worked, but (0, 95) to (2, 95) did not. Do you know what that threshold should be? What is considered too small?

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Powered by Kunena Forum