Add a command-line switch to specify EPS Export level

Bug #669748 reported by Jevon Wright
20
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Wishlist
Vinipsmaker
Inkscape-docs
Fix Released
Medium
Vinipsmaker

Bug Description

As discovered in bug 585286, there is no way to specify the EPS Language Level when exporting a SVG to EPS on the command line.

Because of bug 491590, this means that by default, EPS exports are always PS Level 2.

Workaround: Normally, when exporting an EPS using the command line, the previous setting is used, so by exporting an EPS manually at PS Level 2, all future exports will be at Level 3.

Related branches

Revision history for this message
su_v (suv-lp) wrote :

More generally it might be useful to add a command line option to specify the language level for EPS/PS and PDF export (with Cairo >=1.10 PDF can be either 1.4 or 1.5, see bug #664335), regardless of whether the language level chooser in the GUI is buggy or not.

description: updated
Changed in inkscape:
importance: Undecided → Wishlist
status: New → Confirmed
su_v (suv-lp)
tags: added: cli exporting
tags: added: easy-fix
Changed in inkscape:
assignee: nobody → Vinipsmaker (vinipsmaker)
status: Confirmed → In Progress
Revision history for this message
su_v (suv-lp) wrote :

Just curious: Any specific reason not to use the full PDF version number instead of just the minor one?

Revision history for this message
Vinipsmaker (vinipsmaker) wrote :

> Just curious: Any specific reason not to use the full PDF version number instead of just the minor one?

No reason. I can change that.

What about the PostScript level? Is it okat the way I coded?

Revision history for this message
su_v (suv-lp) wrote :

> What about the PostScript level? Is it okat the way I coded?

A general code review is above my skill level (I don't code C++ myself) - from a user (and bug triage) point of view, the proposed values for the Postscript levels look ok to me (it's what I would expect based on the GUI options), whereas the values for the PDF version irritated me (what if e.g. at some point in the future PDF export adds support for a future major version PDF 2.x?).

@JazzyNico - any comments on this?

Revision history for this message
schwieni (schwieni) wrote :

Interestingly,
for the enums Extension and Parameters someone came to some similar ideas like me:

lp:~schwieni/inkscape/inkscape

;-)

Anyhow, I have 2 comments about the PDF-version:
1) I agree with ~suv, that the pdf version should be more string-like (cf. solution in lp:~schwieni/inkscape/inkscape)
2) I am pretty sure, that the default command-line PDF export version is 1.5 not (as stated in the code/cli-help) 1.4

Regards

Revision history for this message
Vinipsmaker (vinipsmaker) wrote :

@schwieni:

I'll base my trunk on your and just add the PS-export feature. But you should edit the inkscape.pod file and add the new command-line argument there.

I think this is a good plan. What do you think?

Revision history for this message
schwieni (schwieni) wrote :

@Vinipsmaker:

OK, perfect!
I edited the inkscape.pod file and pushed the changes to my repository.
Please, take a look at it.

Revision history for this message
jazzynico (jazzynico) wrote :

Adding project Inkscape-docs so that we update the man files for translation (see http://bazaar.launchpad.net/~inkscape.dev/inkscape-docs/trunk/files/head:/man/).

~suv> @JazzyNico - any comments on this?
I totally agree with you. Since the PDF extension already uses PDF-1.x, it seems natural to reuse the same values for the command line option.

Changed in inkscape-docs:
assignee: nobody → JazzyNico (jazzynico)
importance: Undecided → Medium
status: New → Triaged
Revision history for this message
Vinipsmaker (vinipsmaker) wrote :

@schwieni:

Also change the version to PDF 1.4, if the user don't provide one.

The behaviour should be predictably and should be the same for everyone. Scripts rely on these features (predictability) to work the same way for everyone.

I deleted the merge proposal of my branch. I'll follow the rest of the plan later today.

Revision history for this message
su_v (suv-lp) wrote :

> This patch depends on the Extension::set_param_enum method. This method
> is provided by lp:~schwieni/inkscape/inkscape

The diff (which includes the function to set enum parameters (ComboBox)) is attached to the merge proposal:
<https://code.launchpad.net/~schwieni/inkscape/inkscape/+merge/161225/+preview-diff/+files/preview.diff>

Note for testers of the patch:
Testing the new PostScript command line export options successfully with current trunk also depends on the fix for bug #1173776 (PostScript export via command line with current trunk crashes with >= r12268):

<https://bugs.launchpad.net/inkscape/+bug/1173776>
<https://code.launchpad.net/~vinipsmaker/inkscape/bug1173776/+merge/161300/+preview-diff/+files/preview.diff>

Revision history for this message
su_v (suv-lp) wrote :

A) PostScript level:
'ps-level.patch' tested successfully on OS X 10.7.5 with Inkscape 0.48+devel r12311 (using the two additional diffs as described above):

New PostScript level command line switches work as expected:
$ inkscape -f 669748-solid-gradient.svg -P 669748-solid-gradient-PS2.ps --export-ps-level=2
$ inkscape -f 669748-solid-gradient.svg -P 669748-solid-gradient-PS3.ps --export-ps-level=3

B) PDF version:
The new PDF version command line switches from <lp:~schwieni/inkscape/inkscape> produce warnings or fail:
$ inkscape -f 1173776.svg -A 1173776-PDF_1.5.pdf --export-pdf-version="PDF 1.5"
$ inkscape -f 1173776.svg -A 1173776-PDF_1.4.pdf --export-pdf-version="PDF 1.4"

Sample error messages (vary depending on whether an export option is already stored in the prefs or not, and the stored value):
** (inkscape:90326): WARNING **: desired PDF export version "PDF 1.4" not supported (hint: input the exact string found in pdf export dialog in the command line), using: PDF-1.4 instead!
** (inkscape:17237): WARNING **: desired PDF export version "PDF 1.5" not supported (hint: input the exact string found in pdf export dialog in the command line), using: PDF-1.5 instead!
** (inkscape:17181): WARNING **: desired PDF export version "PDF-1.4" not supported (hint: input the exact string found in pdf export dialog in the command line), using: PDF-1.5 instead!
** (inkscape:17238): WARNING **: desired PDF export version "PDF-1.5" not supported (hint: input the exact string found in pdf export dialog in the command line), using: PDF-1.4 instead!

1) The warnings are contradicting in itself and with regard to the help and manual text
2) The warnings only disappear and a correct PDF version is exported, if the same version was used last time via GUI (i.e. are already stored in the preferences file), and the actual value (not the GUI text) is used on the command line.

Proposing to either
- revert the duplicate status of bug #1173776, so that issues encountered with the PDF command line options from the merge proposal <lp:~schwieni/inkscape/inkscape> can be discussed/tracked separately
or
- use vinipsmaker's solution after it has been updated to use the full PDF version (major.minor) instead of minor only (choosing the PDF version works as expected if using the current proposal from <lp:~vinipsmaker/inkscape/bug669748>)

Revision history for this message
schwieni (schwieni) wrote :

I was thinking, that I solved the warning in <lp:~schwieni/inkscape/inkscape> correctly :-(

@~suv: I now fixed the problem of the false warning in <lp:~schwieni/inkscape/inkscape>. I wanted to give the user feedback if the command-line option provided was not set correctly, which IMHO is very useful to the user. Can you test my code again, please?

Revision history for this message
su_v (suv-lp) wrote :

@schwieni: the latest revision 12307 of your branch seems to work as expected now (both with fresh default preferences file as well as with previously stored values in the preferences file from exporting to PDF via GUI).

Question:
We now have two command line switches affecting the file format version/level of an exported file, which work quite differently (PDF version requires a quoted string (because it contains a space), while PS level can be specified with a single unquoted numerical value).

Would it make sense to unify the values for the command line switches (e.g. PS levels: 2, 3; PDF versions: 1.4, 1.5), and thus getting rid of the extra quotes currently required for the literal PDF version strings taken from the GUI strings?

[Note: possibly (I don't really know) this conflicts with how optiongroups and enums are implemented (value, guitext)]

Revision history for this message
Vinipsmaker (vinipsmaker) wrote :

@schwieni:

Change the version to PDF 1.4, if the user don't provide one. Something like this:

    if((*i)->get_param_enum_contains("PDFversion", sp_export_pdf_version))
        (*i)->set_param_enum(param_name, sp_export_pdf_version);
    else {
        g_warning("Desired PDF export version \"%s\" not supported! Hint: input the exact string found in pdf export dialog in the command line.", sp_export_pdf_version);
        (*i)->set_param_enum(param_name, "PDF 1.4");
    }

Revision history for this message
Vinipsmaker (vinipsmaker) wrote :

> Would it make sense to unify the values for the command line switches (e.g. PS levels: 2, 3; PDF versions: 1.4, 1.5), and thus getting rid of the extra quotes currently required for the literal PDF version strings taken from the GUI strings?

I agree with @~suv.

> [Note: possibly (I don't really know) this conflicts with how optiongroups and enums are implemented (value, guitext)]

It can be done.

Revision history for this message
schwieni (schwieni) wrote :

Ok, I made both changes:

1) @~suv: --export-pdf-version=1.5 works now.
2) @vinipsmaker: default pdf export version is now 1.4

you are welcome

Revision history for this message
Vinipsmaker (vinipsmaker) wrote :

> Ok, I made both changes:
> [...]

Thanks @schwieni.

--
Why doesn't launchpad support Markdown syntax in bug reports (I wanna cry T_T)?

Revision history for this message
Vinipsmaker (vinipsmaker) wrote :

Fixed in commits r12348 and r12350.

Changed in inkscape:
status: In Progress → Fix Committed
su_v (suv-lp)
Changed in inkscape:
milestone: none → 0.49
jazzynico (jazzynico)
Changed in inkscape-docs:
assignee: jazzynico (jazzynico) → Vinipsmaker (vinipsmaker)
status: Triaged → Fix Released
Changed in inkscape:
status: Fix Committed → Fix Released
jazzynico (jazzynico)
Changed in inkscape-docs:
milestone: none → 0.91
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.