Change background color of pdf

12,212

Solution 1

You could probably easily change it with a PDF Editor. There are a few open source ones out there, check out this page http://www.cogniview.com/convert-pdf-to-excel/post/pdf-editing-creation-50-open-sourcefree-alternatives-to-adobe-acrobat/

Solution 2

vector background color (different from scanned image background color that is raster) in pdf is determined by this snippet of code inside a pdf, placed between

stream

and

endstream

tags

/GS1 gs    
1.000 1.000 1.000 rg    
0.00 841.00 m    
595.25 841.00 l    
595.25 -0.85 l    
0.00 -0.85 l    
0.00 841.00 l    
h    
f

in context inside a pdf:

stream    
/GS1 gs    
1.000 1.000 1.000 rg    
0.00 841.00 m    
595.25 841.00 l    
595.25 -0.85 l    
0.00 -0.85 l    
0.00 841.00 l    
h    
f    
endstream

1.000 1.000 1.000 means = white

1.000 0.000 0.000 means = red

1.000 0.749 0.792 means pink and so on...

see these three pdf: (red, pink and white)

http://ge.tt/9ZavuZI

you can obtain these values directly from sodipodi color selector or, if you have a graphic software that indicates RGB color values from 0 to 255 you simply apply the proportion

1:255=x:color you selected

for instance: let say you have this RGB triplet: 30,144,255

30,144,255 rgb image

to know correspondent values in order to insert in code snippet to change pdf background color, you do:

1:255=x:30 = 30/255 = 0.117 (approximated to first three decimals)

1:255=x:144 = 144/255 = 0.564 (approximated to first three decimals)

1:255=x:255 = 255/255 = 1

so you insert, in pdf source code, between stream and endstream tags:

stream    
/GS1 gs    
0.117 0.564 1.000 rg    
0.00 841.00 m    
595.25 841.00 l    
595.25 -0.85 l    
0.00 -0.85 l    
0.00 841.00 l    
h    
f    
endstream
Share:
12,212
dotNetNewbie
Author by

dotNetNewbie

Updated on November 22, 2022

Comments

  • dotNetNewbie
    dotNetNewbie over 1 year

    Is there a way to change the background color of a scanned PDF file? My PDF show a few black lines, and I am trying to remove them.

  • Jim Bak
    Jim Bak about 4 years
    Thank you for this. Where do I change the background page color or remove the background entirely and have a transparent pdf background?