[Wylug-help] Set PDF background to transparent without quality loss
Gary Stainburn
gary.stainburn at ringways.co.uk
Tue Sep 22 09:14:23 UTC 2015
I have decided that the easiest way to do this is use a technique I have used
before for creating computer generated delivery notes etc.
I will create a new PS file with the images emedded as EPS images. That way,
not only will I have total control over the layout etc. but hopefully I will
end up with a smaller PDF file once I do the ps2pdf.
Many years ago I wanted to be able to create PDF files from PHP for both
printing and emailing.
By hand writing the PS files, and embedding tokens, for the text fields,
simple preg_replace statements populate the form before converting to PDF.
I don't know why I didn't just do that in the first place.
Gary
On Monday 21 September 2015 18:56:09 Andrew 'Leny' Lindley wrote:
> FWIW ISTR early FLOSS PDF implementations had problems cos the native
> image format was some flavour/revision of TIFF which is Adobe owned[1].
> Also PDF is based on a subset of Postscript[2]. You might, therefore,
> try things like converting your background to TIFF or EPS before merging
> it. But note, transparency - which seems to be what you're after, is a
> PDF property not in PS[ibid]. So you might try producing your
> background as a PDF with image transparency in something like Scribus
> (FLOSS DTP).
>
> Just ideas,
>
> Leny
>
>
> [1] https://en.wikipedia.org/wiki/Tagged_Image_File_Format
> [2] https://en.wikipedia.org/wiki/Portable_Document_Format#PostScript
>
> On Mon, 2015-09-21 at 10:36 +0100, Gary Stainburn wrote:
> > Thanks Dan,
> >
> > I'm installing inkscape as I'm typing this, and will have a look.
> >
> > I'm also trying to get hold of the original art work.
> >
> > This list has been quiet for a long time, but it's good to see that the
> > meetings are starting up again.
> >
> > Pity it's not convenient for me any more, or I'd bob down.
> >
> > Gary
> >
> > On Monday 21 September 2015 10:15:26 Dan Walker wrote:
> > > Hmm.
> > >
> > > Editing scanned bitmaps might well reduce quality - you won't get
> > > decent-looking lines if the scan goes through a .JPG stage.
> > >
> > > Ideally, you'd get / recreate the invoice paper in a vector package -
> > > You could try asking whoever created it in the first place, or maybe
> > > try converting your scan to vector with Inkscape, then output it as a
> > > PDF after clean-up?
> > >
> > > Failing that—and cleaning up vectors traced from a bitmap can be
> > > tiresome—you could try setting your scanner to produce non-compressed
> > > (or lossless) images such and PNG or GIF, and then convert the white to
> > > transparent with Imagemagick (e.g. see
> > > http://www.imagemagick.org/discourse-server/viewtopic.php?t=12619 - I
> > > haven't tried it though )
> > >
> > > There's no ideal solution from a scanned image, scanned bitmaps are
> > > hard to make look "clean" when they're actually artwork rather than
> > > photographs.
> > >
> > > Yrs,
> > >
> > > Dan
> > >
> > > (Gosh, it's been a while since I posted here ;)
> > >
> > > On 18/09/15 12:47, Gary Stainburn wrote:
> > > > Hi all,
> > > >
> > > > As part of my virtual Printer -> invoice paper -> PDF project I'm
> > > > struggling.
> > > >
> > > > I've got everything working except merging the invoice paper and the
> > > > invoice.
> > > >
> > > > I have a single page PDF with the invoice stationery from a scanned
> > > > original. I have the invoice as produced by our business management
> > > > software
> > > >
> > > > I then ran
> > > >
> > > > pdftk invoice.pdf background invoice_paper.pdf output output.pdf.
> > > >
> > > > Unfortunately this didn't work because our business software splatted
> > > > all over the company logo.
> > > >
> > > > I then tried
> > > >
> > > > pdftk invoice.pdf background invoice_paper.pdf output output.pdf.
> > > >
> > > > which priority to the invoice paper, effectively putting it over the
> > > > invoice instead of behind it. This of course means that the blank
> > > > background of the paper splats over the invoice.
> > > >
> > > > The answer is to make the white background of the invoice_paper.pdf
> > > > transparent. I've tried doing this using PDFedit, convert, and gimp
> > > > but the end result is a significant reduction of the quality of the
> > > > invoice_paper.pdf.
> > > >
> > > > Can anyone suggest al alternative method, preferrably also removing
> > > > the blemishes on the scanned paper.
--
Gary Stainburn
Group I.T. Manager
Ringways Garages
http://www.ringways.co.uk
More information about the Wylug-help
mailing list