lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] Testable alternative to compressed PDFs


From: Vadim Zeitlin
Subject: Re: [lmi] Testable alternative to compressed PDFs
Date: Sat, 10 Feb 2018 23:34:23 +0100

On Sat, 10 Feb 2018 20:41:05 +0000 Greg Chicares <address@hidden> wrote:

GC> 3. Write uncompressed PDFs.
GC> 
GC> I didn't even realize this was possible. Can you show me how to
GC> do it, so that I can experiment with it?

 Before writing a more detailed reply, let me just answer this quickly:

---------------------------------- >8 --------------------------------------
diff --git a/pdf_writer_wx.cpp b/pdf_writer_wx.cpp
index b72b51b9f..ad5240806 100644
--- a/pdf_writer_wx.cpp
+++ b/pdf_writer_wx.cpp
@@ -74,6 +74,7 @@
     pdf_dc_.SetMapMode(wxMM_POINTS);
 
     pdf_dc_.StartDoc(wxString()); // Argument is not used.
+    pdf_dc_.GetPdfDocument()->SetCompression(false);
     pdf_dc_.StartPage();
 
     // Use a standard PDF Helvetica font (without embedding any custom fonts in
---------------------------------- >8 --------------------------------------

With this patch, the generated PDF won't be compressed and you will be able
to find all the text strings in it. The images will still be compressed and
I don't think it's possible to change this easily (PDF doesn't support XPM,
which is the only bitmap format readable as text that I know...), but I
also think it shouldn't really matter.

GC> >  So, depending on what exactly do we want to do, outputting text might not
GC> > be the best solution. Before starting to do it, it would, IMHO, be better
GC> > to clearly understand what are we going to do with the generated text
GC> > files. Would you know the answer to this already and, if so, could you
GC> > please explain it to me?
GC> 
GC> It's hard to say much more than I did above...

 I'd like to know how will the outputs be verified. For example, if it will
be done manually, then uncompressed PDF is not really appropriate because
even though it is readable, for some values of "readable", I can't
seriously claim it's easy to read. OTOH if we just want to run "diff" on
the outputs, then I think it might be sufficient, i.e. the diff obtained in
case of failure could be sufficiently informative.

GC> ...without actual examples of text output. Perhaps we'd be able to
GC> use them the same way we now use '.test' files for system testing.
[...]
GC> we generate about 1200 of these files, and compare each one to a
GC> touchstone (saved, in a separate directory, from a previous run)
GC> using tools like diff.

 If the files are not supposed to change at all, plain diff with
uncompressed PDFs could be all we need. OTOH just changing the header image
size would result in tons of diffs because of the changes to positions of
all text elements, making a real text format a much better tool if such
changes should be allowed to be ignored.

 Regards,
VZ


reply via email to

[Prev in Thread] Current Thread [Next in Thread]