Help with Images in Output PDF

Please post all questions and comments regarding Help & Manual 7 here.

Moderators: Alexander Halser, Tim Green

User avatar
Alexander Halser
EC-Software Support
Posts: 4098
Joined: Mon Jun 24, 2002 7:24 pm
Location: Salzburg, Austria
Contact:

Re: Help with Images in Output PDF

Unread post by Alexander Halser »

Basically it's about the Impict-to-PDF pipeline. An IPP file stores text and shape objects as vectors but they are rendered at low (screen) resolution.
No, Impict images are bit-maps, essentially. They just store additional meta information about the (text) objects, so that the objects can be edited and modified. But even the text is - once rendered - a bitmap.
Alexander Halser
Senior Software Architect, EC Software GmbH
User avatar
Martin Wynne
Posts: 2656
Joined: Mon May 12, 2003 3:21 pm
Location: West of the Severn, UK

Re: Help with Images in Output PDF

Unread post by Martin Wynne »

Alexander Halser wrote:When you use a WMF, EMF
Hi Alexander,

But unfortunately Impict won't export metafiles. I have often wanted that, should I add it to the wish list?

I'm a great fan of EMF metafiles and use them a lot. They seem to have fallen out of favour being an ancient Microsoft format, but they still work great for CAD-style applications and much easier to code to/from a device context than SVG, PDF, XPS vector formats.

regards,

Martin.
User avatar
Alexander Halser
EC-Software Support
Posts: 4098
Joined: Mon Jun 24, 2002 7:24 pm
Location: Salzburg, Austria
Contact:

Re: Help with Images in Output PDF

Unread post by Alexander Halser »

No, it does not export metafiles. It cannot, it's not designed for that at all. Making Impict a vector-based drawing program would be nice, but requires a complete rewrite from scratch including a new image format. We can as well use any SVG editor instead.

What makes vector graphics so complicated in this regard is the transparency option. Once alpha transparency is part of the game - in particular alpha transparency that changes within the object boundaries like opaque at top and transparent at bottom - it becomes extremely difficult to maintain that. H&M does not support this for SVG images, either. Because every link in the drawing chain, from on-screen display to the PDF engine to the PDF viewer, must support it.

When H&M exports an SVG image to PDF, it analyzes it first. If the SVG contains drawing commands that cannot be translated into matching PDF drawing commands, it forces a fork, paints the SVG to a PNG images and exports the PNG instead. If you notice in the PDF, that texts in the image can no longer be selected with the mouse, it's a converted PNG.

In Webhelp, H&M exports the SVG image as it is and leaves it to the web browser to deal with it. If the browser doesn't support it, no longer our problem, so to speak. In CHM files it's almost guaranteed that the MSIE does not support SVG, so we generally convert to PNG for this format. Same for Word documents and ePUB.
Alexander Halser
Senior Software Architect, EC Software GmbH
Simon Dismore
Posts: 454
Joined: Thu Nov 16, 2006 1:29 pm
Location: London, UK

Re: Help with Images in Output PDF

Unread post by Simon Dismore »

Alexander Halser wrote:
Basically it's about the Impict-to-PDF pipeline. An IPP file stores text and shape objects as vectors but they are rendered at low (screen) resolution.
No, Impict images are bit-maps, essentially. They just store additional meta information about the (text) objects, so that the objects can be edited and modified. But even the text is - once rendered - a bitmap.
I think you'll find that the IPP file structure contains all the data you'd need to create an SVG — you could equally well have said "Impict images are vectors, essentially. They just store additional bitmaps...". Here's an example:
impict file structure contains vector data.png
As far as I can see this translates as:
  • 04 Left 02 35 = 4 character property "Left" then one byte value hex 35 is decimal 53
  • 03 Top 03 82 00 = 3 character property "Top" then one word value hex 0082 is decimal 130
  • 0B DisplayName 06 05 Text1 = 11 character property "DisplayName" then string of 5 characters value "Text1"
  • Then the rendered Text1 is stored as a bitmap
  • Hex 18 is decimal 24 character string "Text was added in Impict"
  • ...and so on for the alignment, font-name, colour etc.
The SVG equivalent would be:

Code: Select all

    <image
        xlink:href="capture.png"
        width="360"
        height="152"
        preserveAspectRatio="none"
    />
    <text 
        id="Text1" 
        transform="matrix(1 0 0 1 53 130)" 
        style="fill:#008000; font-family:'TimesNewRomanPSMT'; font-size:11px;">
        Text was added in Impict
    </text>
It seems to me that either Impict could support SVG and indeed EMF as additional output formats, or H&M could have an option to convert IPPs to layered SVGs. Either way, you'd have control of the process so you could prevent any incompatible commands, transparency etc.
You do not have the required permissions to view the files attached to this post.
Last edited by Simon Dismore on Thu Feb 09, 2017 12:09 pm, edited 3 times in total.
User avatar
Martin Wynne
Posts: 2656
Joined: Mon May 12, 2003 3:21 pm
Location: West of the Severn, UK

Re: Help with Images in Output PDF

Unread post by Martin Wynne »

Alexander Halser wrote:No, it does not export metafiles. It cannot
Hi Alexander,

Thanks for the detailed reply.

Clearly you know your own program, but I'm a bit surprised by this.

To export a metafile rather than a bitmap, I simply use the same drawing routine and pass a TMetafileCanvas instead of a TCanvas.

StretchDrawn bitmaps go into the metafile as bitmap objects, but items drawn on the canvas using Pens and Brushes (i.e. text, lines, filled polygons, etc.) remain as drawing commands in the metafile and display as crisp vector items when zoomed.

For me, one big advantage of this ancient Microsoft technology is that it works fine in Wine on Linux systems, including in CrossOver on a Mac, which suits many of my users.

regards,

Martin.
Post Reply