Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 665809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T23:44:57+00:00 2026-05-13T23:44:57+00:00

I’m creating a dynamically generated PDF using FPDF. My PDF requires many exactly horizontal/vertical

  • 0

I’m creating a dynamically generated PDF using FPDF.

My PDF requires many exactly horizontal/vertical lines in a grid and when rendered they are anti-aliased and look very fuzzy and unacceptable to the client. I need to remove the anti-aliasing for these(or all) lines in the doc.

I know this is possible because it’s shown correctly in the adobe pdf specs itself
http://www.adobe.com/devnet/acrobat/pdfs/PDF32000_2008.pdf (warning: big file)
see the box in page 2 for how this should look.

How would I duplicate the box shown on this page?

— EDIT —

%PDF-1.6
3 0 obj
<</Type /Page
/Parent 1 0 R
/Resources 2 0 R
/Contents 4 0 R>>
endobj
4 0 obj
<</Length 44>>
stream
2 J
1.00 w
20.00 821.89 m 200.00 821.89 l S

endstream
endobj
1 0 obj
<</Type /Pages
/Kids [3 0 R ]
/Count 1
/MediaBox [0 0 595.28 841.89]
>>
endobj
2 0 obj
<<
/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]
/Font <<
>>
/XObject <<
>>
>>
endobj
5 0 obj
<<
/Producer (FPDF 1.6)
/CreationDate (D:20100311190240)
>>
endobj
6 0 obj
<<
/Type /Catalog
/Pages 1 0 R
/OpenAction [3 0 R /FitH null]
/PageLayout /OneColumn
>>
endobj
xref
0 7
0000000000 65535 f 
0000000179 00000 n 
0000000266 00000 n 
0000000009 00000 n 
0000000087 00000 n 
0000000360 00000 n 
0000000435 00000 n 
trailer
<<
/Size 7
/Root 6 0 R
/Info 5 0 R
>>
startxref
538
%%EOF

This is a very simple PDF file that draws a single line showing the issue I’m having. I’ve figured out that the trick is to add this:

/Type /ExtGState
/SA false

But I can’t get it to work yet. SA is defined in 10.6.5 in the above PDF specs

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T23:44:58+00:00Added an answer on May 13, 2026 at 11:44 pm

    I don’t have the exact answer, but I have and idea that’s a bit more than a comment…

    Since you are already comfortable with the PDF specs, here’s what you should try:

    Figure out how fpdf is actually drawing those lines. Chances are the pdf file it outputs is compressed, so you should download pdftk to uncompress it. You would do that with the command:

     pdftk fpdf_output.pdf output fdf_readable.pdf uncompress
    

    Open up the pdf in a text editor and see if the lines are drawn the same way as the example in the PDF specs you are looking at.

    If they are not, see if the method fpdf uses to draw the lines has an anti-aliasing option (in the PDF specs, I mean). If fpdf is drawing it the same way (or if their way has the option), try changing your output document (in the text editor) to have the anti-aliasing turned off. If the document won’t open after editing it in the text-editor, you can run:

     pdftk fdf_readable.pdf output fdf_fixed.pdf
    

    and it should fix any broken references or byte counts.

    Then open up your tweaked pdf to see if it looks like what you are going after.

    Here’s the bad news: The only thing the above accomplishes is verifying that anti-aliasing is or isn’t possible via the methods fpdf is using under the hood. If it is possible, there is some hope that the feature already exists or that you can make a feature request or if you are feeling really confident, you could try to extend fpdf to include some kind of antialias("true|false") method. If the method they use to draw the lines is not the same as the specs and doesn’t have an option to turn off anti-aliasing, your best bet is probably to find an alternative pdf generator, like tcpdf, and seeing if they offer that feature.

    Update

    Okay, I’d like to first point out that I still don’t see the fuzziness. So I can’t tell if this actually fixes your issue. But I did add the Automatic Stroke Adjustment rule to your example and the PDF still opens.

    In the interest of not posting the entire PDF again, here’s how you can update your sample code:

    .........
    /Font <<
    >>
    /XObject <<
    >>
    
    //Start my edit right below this point in your example, so at line 31, add:
    
    /ExtGState << /GS1 10 0 R
    >>
    >>
    endobj
    10 0 obj
    <<
    /Type /ExtGState
    /SA true
    /TR 11 0 R
    >>
    endobj
    31 0 obj
    << /FunctionType 0
    /Domain [0.0 1.0]
    /Range [0.0 1.0]
    /Size 2
    /BitsPerSample 8
    /Length 7
    /Filter /ASCIIHexDecode
    >>
    stream
    01 00 >
    endstream
    endobj
    // Your code picks back up with:
    
    5 0 obj
    <<
    /Producer (FPDF 1.6)
    

    Basically all I’ve done is added a dictionary object reference to the main resource dictionary and then created the actual dictionary object with the stroke adjustment rule set to true. I also threw in the transfer function that the spec example has, because i’m not sure if that makes a difference. It can easily be taken out.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 450k
  • Answers 450k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Remove the semicolon ";" after login() JavaScript is seeing that… May 15, 2026 at 8:35 pm
  • Editorial Team
    Editorial Team added an answer As i understand what your code does you should do… May 15, 2026 at 8:35 pm
  • Editorial Team
    Editorial Team added an answer This is maths rather than programming, but briefly: It's in… May 15, 2026 at 8:35 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.