Author Topic: Option to produce compressed PDF  (Read 1184 times)

alpha1

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
Option to produce compressed PDF
« on: June 03, 2015, 10:04:48 pm »
I am teaching Scribus to several people, most of whom use Microsoft Windows. In my own experience over the years, I have found that the PDF files created by Scribus are very large. I normally do my own work in LINUX, and have found a workflow to create compressed PDF files which works fine for me, but would not be suitable for most of the students in my class, as none of them use LINUX nor are they at all familiar with working with Scripts.  The ideal solution would be to have an option within Scribus when creating a PDF file to produce either full or compressed version. An acceptable alternative would be to have a separate GUI based program to run the script in Windows as well as Mac and LINUX.
The Script I use to do the job is a slightly modified version of  the Perl script, compress_newsletter.pl, the original for which can be found here: http://wiki.scribus.net/canvas/Web_optimised_PDF
(I don't think the original works any more).
I have attached the script I use as a text file called compress_newsletter.pl.txt -- remove the ".txt" and make it executable to run. I was not permitted to attach it with the .pl extension.
My normal work-flow is to run the script:
compress-newsletter.pl {original file name}.pdf

the result is {original file name}.new.pdf

The script cleans up a lot of the temporary files it creates, but does leave a file {original file name}.meta, which really should be deleted within the script (I delete it manually).

Normally, I then do:
rm {original file name}.pdf
mv {original file name}.new.pdf {original file name}.pdf

It would be nice if the script were modified so that
a) the meta file is removed automatically
b) an option would be to replace the original file.  I would suggest that running it without any option would leave both files, but doing:


compress-newsletter.pl -r {original file name}.pdf

would result in the original file be replaced.

----------

Now comes the more interesting challenge:

As I mentioned earlier, virtually all of the people attending my Scribus training are using Windows and have relatively limited computer skills.  It would be great to have a GUI to run this script in Windows to accomplish this task, or better yet, to have the functionality built into Scribus

Anyone interested in the challenge of creating something like this (it would be even nicer if it would run in LINUX and OS-X)?

Alpha1


a.l.e

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1201
  • Karma: 18
    • the graphics lab
Re: Option to produce compressed PDF
« Reply #1 on: June 04, 2015, 10:59:59 am »
hi

last year, i've started to collect some thoughts on this topic but never went on and produced some code...

if somebody joins the efforts, maybe something will come out of it...

the idea was to create a python3 / pyqt5 frontend to the tools used by the scripts mentioned on the scribus wiki.

the repository is here

https://github.com/aoloe/scribus-tool-pdfshrinker

but it's still empty...

anybody wanting to spend a day with me on this?

a.l.e

alpha1

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
Re: Option to produce compressed PDF
« Reply #2 on: June 04, 2015, 03:46:11 pm »
Brendan (a member of Victoria LINUX Users' Group, VLUG, E-Mail list) has modified the script to perform the actions I requested:
line 63: add -r and --replace options
line 183: add metafile to rm list
lines 187-193: remove infile and rename outfile to infile

The updated version is attached as a text file