I'm aware you say you "can't use any external application". However, you may actually be able to do so. (Disclaimer: you don't really give a reason why this won't work, so I'm going to assume it can.)

First off, a brief point about the mentality of unix, where perl derives much of its design from. That is, do one thing and do it well. There are programs out there that do pdf conversions, do that well, and that's all they do. There is significant advantage to using them: they work, they're efficient, and you don't need to debug them.

Next. No one says that you need to create an HTML file and tell the user to call html2ps. Or to create an XML file and tell the user to call fop. You can create the HTML or XML files, and call html2ps or fop yourself. Automatically. With no user intervention. Yes, you'll have an external dependancy. But the output of your program is still a simple PDF. You can concentrate, then, on aspects of your application that are directed towards content without worrying about how to embed SVG into PDF or anything silly like that. Let the converters deal with those details. Do your job, do it well, and leave parts that aren't relevant to your problem to others.

You'll save a lot of time that way. ;-) You may incorporate those other programs into your solution, but they aren't really part of the problem you're solving, which is to get information to the proper users. Concentrate on that. :-)


In reply to Re: HTML and SVG to PDF by Tanktalus
in thread HTML and SVG to PDF by josera

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.