Issue 10199 - Include pdfmark support in OO.o
Summary: Include pdfmark support in OO.o
Status: CLOSED DUPLICATE of issue 4798
Alias: None
Product: xml
Classification: Code
Component: documentation (show other issues)
Version: OOo 1.0.1
Hardware: All All
: P4 Trivial with 9 votes (vote)
Target Milestone: OOo 2.0
Assignee: bettina.haberer
QA Contact: issues@xml
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-12-18 19:28 UTC by Unknown
Modified: 2003-09-10 16:10 UTC (History)
5 users (show)

See Also:
Issue Type: ENHANCEMENT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Unknown 2002-12-18 19:28:33 UTC
pdfmark provides the capability for PDF files to contain enhanced features 
such as indexes, hyper-text links, notes, etc. If OO.o could have the 
necessary support for pdfmarks, then it would be possible to create 
maintainable PDF's with advanced features. 
 
This would also move much of the functionality of Adobe Acrobat (Not Reader) 
into OO.o. 
 
Documentation is available on Adobe's web site as well as other locations.
Comment 1 michael.brauer 2003-01-07 14:57:14 UTC
.
Comment 2 eric.savary 2003-04-16 15:38:29 UTC
Set to "NEW"
Comment 3 hesse 2003-05-20 09:22:11 UTC
http://www.openoffice.org/issues/show_bug.cgi?id=9954
This issue is asking for support of special pdfmark in OOo
Comment 4 settantta 2003-06-23 03:11:05 UTC
A user on the users list has created a perl script whic suplies some
of the functionality required. I've asked him to attach his script to
this issue in case it is of assistance.
Comment 5 ncdave 2003-06-23 07:31:26 UTC
Per Alex's request...

Since OO.o Writer couldn't be coaxed into generating pdfmarks
in postscript output (for making PDFs with hyperlinks) I
found another way.  I've managed to get working hyperlinks
into my book by inserting postscript prefix code with pdfmarks
into the postscript output generated by openoffice.org writer
when writing to a windows postscript driver.

To create the document, I print to a postscript printer
driver, with the print-to-file option.  Then I insert the
special postscript prefix (I wrote a Perl program to automate
this).  Then I run ps2pdf12 (which is similar to Adobe
Distiller, but comes free with ghostscript).

The result is a .pdf file in which the page numbers in the
index, table of contents, and "see p. xxx" references are all
working hyperlinks.

It works pretty well.  But it isn't perfect:

1) A few things that aren't really page numbers also get
turned into hyperlinks.  So, to make this flaw less obvious,
I chose to NOT make the hyperlinks underlined or blue or
visually distinctive in any other way.  Instead, I just
added instructions to the user telling him that he can
click on any page number to go to that page.  Most users
will probably never notice that they can also click on a
few other integers in the document, with the same effect.
(This also means that I can use the same version of the
..pdf file for viewing and printing.)

2) Hyperlinks always link to the page number, not directly
to the item which is on the page.

3) Be sure that you make the page numbers in the document
consistent with Acrobat Reader's notion of page numbers:
i.e., they should be integers, and the first page should
be page 1.  (But really, this is advisable, anyhow.)

4) It doesn't work with all postscript drivers.  It works with
the "regular" Windows postscript printer driver that I use for
my HP LaserJet 4M, but it doesn't work with the Adobe Distiller
driver.

(Note: the Distiller driver is bad in other ways, too:
for my 400 page book, the LJ 4M driver generates 5.5 MB of
postscript output, but the Distiller driver generates 73 MB
of postscript output!  That's 1200% bigger.  Ugh!)

Still, in spite of the limitiations, this approach does work, and
the result is a whole lot better than having no hyperlinks at all.

You can view the result here:
http://www.burtonsys.com/tlib_doc.pdf

You can see my postscript code, and a little Perl program
to insert it, here:
http://www.burtonsys.com/daves_hyperlink_stuff.zip
(Note: there are useful comments about this process in both
files.)

If anyone else uses this, I'd like them to please send me an
email and tell me about it.

-Dave
Comment 6 ncdave 2003-07-04 07:52:36 UTC
This note is adapted from my 24 May 2003 19:54:58 message on the 
[users@openoffice.org] mailing list.  Note that it is earlier than my 
previous note here, about with the postscript prefix code to get 
working hyperlinks.  When I wrote this, I had not yet written the 
postscript prefix code.  But I think this is still relevant.

The gist is this: OOo Writer already has the ability to represent 
pdfmarks in a document file.  But it won't print them to the 
postscript output.

Here's the long version:

On 14 May 2003 dave192@burtonsys.com (David Burton, that's me) wrote:
> Hmmm... the pdfmarks could be inserted if there were a way to
> put a "printer escape sequence" containing "raw printer codes"
> into an OO Writer document.
>
> Is there a way to do that?  (basd1@fastbk.com asked this
> question 11 months ago, but apparently got no answer.)

Well, like basd1, I got no answer to this question.  So I did
some experiments.  (I put the printer escape sequences
(M$ "Print fields") into M$ Word documents which I then
imported into OOo Writer.)

Result: it *is* possible to represent "printer escape
sequences" containing raw printer codes in an OOs Writer
document (though I don't know whether it can be done from
within the OOo Writer GUI).

Here are a couple examples of pdfmark PostScript codes from
a content.xml file extracted from a .sxw document file;
they happen to be the target and reference, respectively,
for a PDF hyperlink:

<text:user-field-get text:name="PRINT \p 
Group "[/Dest /mytestlink /DEST pdfmark""/>
<text:user-field-get text:name="PRINT \p Group "[/Rect [ 56 330 100 
360 ] /Border [ 16 16 1 ] /Color [0 0 
1] /Dest /mytestlink /Subtype /Link /ANN pdfmark ""/>

However, there's a problem:  OOo Writer won't put them into its
printed (PostScript) output.  The only way I've found to get
them into the "print to file" PostScript output, where they
belong, so that I can then get the link into a PDF file via
ps2pdf or Adobe Distiller, is... (y'all are REALLY gonna
hate this!):

1) Export to RTF.
2) Load the .rtf file into M$ Word.
3) Print from M$ Word.

Yes, that's right.  OOo Writer properly exports the printer codes
to an RTF file, but won't put them into the printer output.
<sigh!>

Unfortunately, exporting to RTF and printing from M$ Word is not
really a good solution, because exporting to RTF loses too
much other information (scrambles the output in other ways).  :-(

So... does it count as a bug that OOo Writer can represent a
printer escape sequence in its .sxw file, and even properly
export it to an RTF file, but won't spit it out into the output
stream when printing?  Should I open a different Issuesilla issue?

Regards,
-Dave



For context, here's my own earlier message to which I replied...
On 14 May 2003 dave192@burtonsys.com (David Burton) wrote:

> Message-ID: <BosVeHvcwapi@burtonsys.com>
> Date: Wed, 14 May 2003 10:38:35 -0400 (EDT)
> Subject: Re: [users] PDF with intact hyperlinks?
>
> Jean Hollis Weber <jean@taming-openoffice-org.com> wrote:
> > David Burton wrote:
> > > ... is there any way to make a .pdf file with working
> > > hyperlinks from an OO Writer .sxw file?  Perhaps using a
> > > purchased tool from Adobe or elsewhere?
> > >
> > > I'd like the exported PDF file to contains working relative
> > > (internal) hyperlinks for TOC entries, alphabetical index
> > > entries, and "see page xxx" links.  Working external (web
> > > site) links would be a bonus.
> >
> > Unfortunately, the answer is no, there is no way at present, 
unless you
> > want to learn how to manually insert PDFMarks into the PostScript 
file.
> > This prospect seems too awful to contemplate, and I'm not sure it 
would
> > work anyway. (I remember PDFMarks from many years ago, but never 
had to
> > learn how to use them.)
> >
> > Regards, Jean
> > Jean Hollis Weber
> > jean@taming-openoffice-org.com
> > Taming OpenOffice.org Writer now available!
> > http://www.taming-openoffice-org.com/tow/
>
> Hmmm... the pdfmarks could be inserted if there were a way to
> put a "printer escape sequence" containing "raw printer codes"
> into an OO Writer document.
>
> Is there a way to do that?  (basd1@fastbk.com asked this
> question 11 months ago, but apparently got no answer.)
>
> If there's a way to embed printer escape sequences into an
> OO Writer document, then I think I could cobble something
> together (probably a Perl script) to automatically add the
> escape sequences with the pdfmarks to a temporary copy of
> the unzipped content.xml file, before "printing" it to
> postscript file.
>
> The strategy would be that whenever I want to generate a .pdf
> with hyperlinks, I would:
> 1) Run the Perl script to make a new/temporary .sxw file with
> the printer escape sequences, containing pdfmarks (derived
> from the hyperlinks already in the document), and then
> 2) "Print" to a postscript file, thus generating the
> postscript file with pdfmarks, and then
> 3) Process the postscript with Adobe Distiller or pdfwrite
> to generate a .pdf file with working hyperlinks.
>
> So... is there a way to embed a "printer escape sequence"
> in the content.xml?
>
> Thanks,
> -Dave
Comment 7 ggabriel 2003-07-22 16:11:26 UTC
Could a script or something that worked with the new PDF Export
function of OOo 1.1 be created so that the document hyperlinks got
translated into PDF hyperlinks in the exported file?

thx!
Gabriel
Comment 8 falko.tesch 2003-09-10 13:58:49 UTC
I do support the idea of preserving bookmarks/URL from Writer
documents to PDFs.
But priority P3 is IMHO too high.
I retarget this issue to P4 and OO.o 2.0.
Bettina: Can you please add this to you list of little issues of nice
to haves?
Comment 9 bettina.haberer 2003-09-10 16:09:54 UTC
Duplicate to 4798.

*** This issue has been marked as a duplicate of 4798 ***
Comment 10 bettina.haberer 2003-09-10 16:10:21 UTC
Closed as duplicate.