Scaling images in PDF output?

This forum is for all Flare issues related to PDF, eBook, Microsoft Word, Adobe FrameMaker, XPS, and XHTML book targets.
Post Reply
FrankyT
Propeller Head
Posts: 56
Joined: Wed Apr 04, 2012 3:45 am
Location: United Kingdom

Scaling images in PDF output?

Post by FrankyT »

I want to produce a PDF in which all images are the same resolution (but not their default size, which is too big for PDF output).

The problem is that Flare does not allow you to specify percentage image sizes in PDF output: you can only specify absolute sizes. Currently, this means that I have two options:

- Work out each image's absolute width manually (a pain when you have several dozen images in a document, and a particular pain when you need to update screen shots and go through the whole lot again)

- Use a rule of thumb - e.g. "5cm for a screen shot of a small dialog box, 8cm for a medium dialog box, 14cm for a full window" etc.
This is quicker than the first option, but often doesn't work first time, and also it means there are small discrepancies in resolution where images aren't exactly the same size.

Does anyone know a way of resizing images by scaling them, rather than using absolute dimensions?

NB My question applies only to print output. I want images in HTML5 output to remain their full size.

Thanks,

Franky
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: Scaling images in PDF output?

Post by LTinker68 »

First, you mention resolution then you mention dimension. Those are two different things. From the rest of the post, it sounds like you're talking about dimensions, or the physical amount of space it appears to take on the screen. And yes, you can do that through styles. If you generally put the images in paragraph tags, then create paragraph classes for the various situations you mention, then apply the appropriate paragraph class to control the sizing. I'd use complex selectors, as well. So your stylesheet file might look something like the following (when opened in the text editor):

Code: Select all

p.smallDialog img {
    max-width:5cm;
}

p.medDialog img {
    max-width:8cm;
}

p.fullScr img {
    max-width:14cm;
}
By using styles, you can reuse an image in multiple locations in a project in various sizes without having to create those different sized images outside of Flare.

As for print versus online input... You'd create the p.smallDialog, p.medDialog, and p.fullScr classes in the online (default) medium but there wouldn't be any attributes specified for them, so they'd inherit their attributes from the main paragraph tag. The complex selectors above would be put into the print medium so they're only used when you build print output (or when an end user prints from the browser, if you use the basic print medium).
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
FrankyT
Propeller Head
Posts: 56
Joined: Wed Apr 04, 2012 3:45 am
Location: United Kingdom

Re: Scaling images in PDF output?

Post by FrankyT »

Thanks Lisa, but it's resolution I'm talking about, not dimensions.

For example, say I have 2 screen shots, one that is 768 pixels wide, and one that is 810 pixels wide. Clearly, they are of /similar/ size, but if I specify an absolute width for them both in print output (e.g. 11cm), then there will be slight differences in their /resolutions/ in the PDF.

In other words, I want them all the same resolution, and I don't mind about them being different dimensions. I would like to find a scale percentage that is suitable for all screen shots, and then to apply this throughout the document. A scale percentage of 100% (i.e. the default) is no good for print - I get lots of oversized images. Something between 50% and 70% is what I'm looking for.

I'm finding it a pain to have to specify the maximum absolute width of each image individually. This is not what I want. I want all the images the same resolution - in other words, I want a pixel in screen shot A to be the same size as a pixel in screen shot B.

Thanks,

Franky
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: Scaling images in PDF output?

Post by LTinker68 »

FrankyT wrote:For example, say I have 2 screen shots, one that is 768 pixels wide, and one that is 810 pixels wide. Clearly, they are of /similar/ size, but if I specify an absolute width for them both in print output (e.g. 11cm), then there will be slight differences in their /resolutions/ in the PDF.
When viewed on the monitor, or when printed? Images in PDFs are notoriously bad viewing on a monitor unless you zoom really far in. An image that's small on the page (e.g., 2" x 3") but has a high resolution (e.g., 150dpi or 300dpi) may look terrible when viewed on a monitor unless you zoom in, but prints great.
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
techwriter31
Propellus Maximus
Posts: 551
Joined: Wed Mar 05, 2008 10:50 am

Re: Scaling images in PDF output?

Post by techwriter31 »

I submitted this an enhancement request a few years ago. Hopefully, it will be implemented in one of the upcoming releases!
Kellie
FrankyT
Propeller Head
Posts: 56
Joined: Wed Apr 04, 2012 3:45 am
Location: United Kingdom

Re: Scaling images in PDF output?

Post by FrankyT »

LTinker68 wrote: When viewed on the monitor, or when printed? Images in PDFs are notoriously bad viewing on a monitor unless you zoom really far in. An image that's small on the page (e.g., 2" x 3") but has a high resolution (e.g., 150dpi or 300dpi) may look terrible when viewed on a monitor unless you zoom in, but prints great.
I should have avoided the term "resolution". I mean "scale". I want all my images to be to the same scale in the printed document.

The images are screen shots, so one pixel in an image equals one pixel on the original screen display. Thus, the source images are all of the same resolution. What I want is to scale them all by the same amount - 50-70% - in the print output, so that they are not oversized.

And yes, I know I can set a maximum width so that images don't run off the page, but that is not the only issue - the default scale is larger than I want even for smaller images.

Anyhow, techwriter31 seems to be confirming that what I want is not possible in Flare. It is annoying. You can scale an image by percent in every other common word processor (Word, FrameMaker).
Nita Beck
Senior Propellus Maximus
Posts: 3667
Joined: Thu Feb 02, 2006 9:57 am
Location: Pittsford, NY

Re: Scaling images in PDF output?

Post by Nita Beck »

Unless I'm wrong (which I might be), I think the shortcoming lies with CSS, not with Flare (which is not a word processor). A percentage in CSS is a percentage of a containing block. So say an image is within a <p> block and it's set to a percentage of 72%, that's going to be 72% of however wide that paragraph ends up being in a generated target. Add multiple targets into the mix and that percentage can yield unexpected results.

When I adopted Flare, I spent lots of time calculating the pixel sizes for the max-widths of individual images so that I'd get exactly the same scale, percentage-wise, for all of the images. But that meant I was applying inline formatting to every image. Within six months, I gave up on that and instead came up with a set of img classes to control image size: img.Full, img.ThreeQuarters, img.TwoThirds, and so on. I can define different max-widths for each of those image classes, and for different mediums. For instance, if I'm producing PDF and the page layout's body frame is 6.5 inches wide, then the img.Full would have a max-width of 6.5 inches, img.ThreeQuaters would have 4.88 inches, and so forth. If I'm producing online Help, the img.Full might have a max-width of 10 inches ('cause anything wider is kind of impractical, as then the user would have to scroll right), img.ThreeQuarters would be 7.5 inches, and so forth.

I admit that this scheme does not give me precise scaling of images, but it avoids inline formatting completely, which supports reuse/single-sourcing.

(I guess I'm just repeating what Lisa already described above. Sorry...)
Nita
Image
RETIRED, but still fond of all the Flare friends I've made. See you around now and then!
FrankyT
Propeller Head
Posts: 56
Joined: Wed Apr 04, 2012 3:45 am
Location: United Kingdom

Re: Scaling images in PDF output?

Post by FrankyT »

Nita Beck wrote:Unless I'm wrong (which I might be), I think the shortcoming lies with CSS, not with Flare (which is not a word processor).
Well, Flare is a tool for producing professional-quality documents, which surely makes it a word processor by any sensible definition!

As for where the shortcoming lies: Madcap chose to use HTML and CSS as the Flare source format [1], and I think it's up to Madcap to make sure that they work for end users. Madcap have already added a lot their own style settings where they aren't covered by standard CSS, and it would be nice to see percentage-scaled images introduced in the same vein.

Flare is an excellent tool in many ways, but I feel this is a significant shortcoming.

[1] In many ways I think this was a good decision, since HTML and CSS are transparent and familiar to many (most?) technical writers.
James Protz
Jr. Propeller Head
Posts: 2
Joined: Wed Oct 08, 2014 6:32 pm

Re: Scaling images in PDF output?

Post by James Protz »

I'm a relative Flare novice, so apologies if I haven't worded this quite right. I think my issue is somewhat similar to FrankyT's. I've generated a manual with an HTML5 output, and it looks not too bad. If I want to take the same document and output it to a PDF, that is when the original image size (which was good for HTML5) is now too large for the PDF document, they now go off the page. Does one have to alter the image sizes for a PDF output, or is there a better way to contain them within the borders of the PDF document?

Yes,I have much to learn :?
kmorrison
Sr. Propeller Head
Posts: 104
Joined: Mon Nov 11, 2013 3:04 pm
Location: Ottawa, Canada
Contact:

Re: Scaling images in PDF output?

Post by kmorrison »

Actually, James Protz, I think this could be relatively simple if your issue is exactly the same as the original poster described.

If you don't specify the size of an image in Flare, it looks at the image file to determine how many pixels per inch the image should be in the PDF. However, this information does not affect the size of the image in the HTML5 help (at least not with the image types I was working with).

So here's all you'd have to do:

Figure out what the maximum width for your image on the PDF page is. (Eg. 7 inches.)
Figure out how many pixels across your biggest sceenshot is going to be. (Eg. 1400 pixels).
Divide the number of pixels by the number of inches. (eg. 1400/7 = 200) This is the number of pixels per inch that all of your source image files should be.

The only way I know of to change the number of pixels per inch in an existing image, off the top of my head, is to open the image in Photoshop and use the image size window to make the change. I am sure there are many other ways to do it, and some of the other ways might be easier.

This way, you don't need to set any image sizes using Flare. (I discovered this when I was revamping a project and stripped out all of the local formatting specifying image sizes, and some of my screenshots shrunk to the size of a peanut, but only in the PDF. After some bewilderment, I realized that the number of pixels per inch in the image files was unreasonably high. Once I set it to something sensible, the images were a sensible size.)
Last edited by kmorrison on Thu Apr 09, 2015 4:37 pm, edited 3 times in total.
techwriter31
Propellus Maximus
Posts: 551
Joined: Wed Mar 05, 2008 10:50 am

Re: Scaling images in PDF output?

Post by techwriter31 »

We have a couple of PDF mediums in our stylesheets for our various PDF page sizes.

For our 8x11 PDFs, the body frame in the page layout is 7 inches wide, so I added the following to the .css for this medium:

Code: Select all

	img
	{
		max-width: 6.50in;
	}
I originally had the max-width equal to the width of the body frame (7 inches), but found that some images still extended a bit beyond the page in the PDF output.

This ensures that the image doesn't exceed the body frame for this output. However, images are automatically resized in this case, so the image resolution still may not be optimal.
Kellie
kmorrison
Sr. Propeller Head
Posts: 104
Joined: Mon Nov 11, 2013 3:04 pm
Location: Ottawa, Canada
Contact:

Re: Scaling images in PDF output?

Post by kmorrison »

techwriter31 wrote:We have a couple of PDF mediums in our stylesheets for our various PDF page sizes.

For our 8x11 PDFs, the body frame in the page layout is 7 inches wide, so I added the following to the .css for this medium:

Code: Select all

	img
	{
		max-width: 6.50in;
	}
I originally had the max-width equal to the width of the body frame (7 inches), but found that some images still extended a bit beyond the page in the PDF output.

This ensures that the image doesn't exceed the body frame for this output. However, images are automatically resized in this case, so the image resolution still may not be optimal.
That's what I do too, since I'm not concerned about the images all being the same scale.
jdyer
Jr. Propeller Head
Posts: 7
Joined: Thu Sep 17, 2015 11:01 am

Re: Scaling images in PDF output?

Post by jdyer »

techwriter31 wrote:We have a couple of PDF mediums in our stylesheets for our various PDF page sizes.

For our 8x11 PDFs, the body frame in the page layout is 7 inches wide, so I added the following to the .css for this medium:

Code: Select all

	img
	{
		max-width: 6.50in;
	}
I originally had the max-width equal to the width of the body frame (7 inches), but found that some images still extended a bit beyond the page in the PDF output.

This ensures that the image doesn't exceed the body frame for this output. However, images are automatically resized in this case, so the image resolution still may not be optimal.
This just fixed my life! Thanks a ton, techwriter31. :D
Julious Dyer
Technical Writer
techwriter31
Propellus Maximus
Posts: 551
Joined: Wed Mar 05, 2008 10:50 am

Re: Scaling images in PDF output?

Post by techwriter31 »

Great, I'm glad it helped! :)
Kellie
dalewood
Propeller Head
Posts: 36
Joined: Wed Aug 29, 2007 1:47 pm

Re: Scaling images in PDF output?

Post by dalewood »

I know this is an old thread, but I have this same issue with PDF output.

I see the solution from techwriter31, but I am a long time Flare novice.

How do you use the code solution of:

img
{
max-width: 6.50in;
}

I ask as I have a default.css and when I open it up in the Stylesheet editor it shows a grid, not code as listed in the solution.
BaritoneJP
Propeller Head
Posts: 49
Joined: Mon Jun 02, 2008 9:12 am
Contact:

Re: Scaling images in PDF output?

Post by BaritoneJP »

dalewood wrote:How do you use the code solution of:
The key to techwriter31's comment:
techwriter31 wrote:We have a couple of PDF mediums in our stylesheets for our various PDF page sizes.
Flare's help topic for creating mediums:
http://help.madcapsoftware.com/flare201 ... -Types.htm

It looks like this in my main stylesheet:

Code: Select all

@media print
{
	img
    {
		max-width: 6.50in;
    }
}
dalewood wrote:Stylesheet editor it shows a grid, not code as listed in the solution.
The Flare blog had a great tip getting Notepad++ in the right-click menu:
https://www.madcapsoftware.com/blog/201 ... -in-flare/
Thank you for your comments and help with my quandary ...
Jamey
sds
Propeller Head
Posts: 48
Joined: Tue Jun 26, 2018 11:29 am
Location: Tucson

Re: Scaling images in PDF output?

Post by sds »

techwriter31 wrote:We have a couple of PDF mediums in our stylesheets for our various PDF page sizes.

For our 8x11 PDFs, the body frame in the page layout is 7 inches wide, so I added the following to the .css for this medium:

Code: Select all

	img
	{
		max-width: 6.50in;
	}
I originally had the max-width equal to the width of the body frame (7 inches), but found that some images still extended a bit beyond the page in the PDF output.

This ensures that the image doesn't exceed the body frame for this output. However, images are automatically resized in this case, so the image resolution still may not be optimal.
Man... That was a long saga of a thread just to arrive at techwriter's solution. Worked like a charm. Techwriter31... still saving the day in 2020.
sarahb
Propeller Head
Posts: 28
Joined: Sun May 14, 2017 6:30 pm

Re: Scaling images in PDF output?

Post by sarahb »

I think my issue may be slightly different, but setting a max-width for images doesn't work for me. This is for the print medium.

My issue is that I have images with various indents based on whether the image falls under a numbered list or bulleted list (or a sub-bullet which is nested even further). I have max-width: 100%;, thinking it would be 100% of the maximum width of the object it's contained--in this case, I thought the container was the page layout margins. But the image doesn't seem to respect the right margin, it overflows. How can you say: "hey image, you can be as big as you need to be, but no wider than the right margin"?

Can you define a container to put the image in? That container would have a set maximum width (say 7in), and then the image max-width would be 100% of the container width, which is 7in.

Sarah
Post Reply