public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Strategies for image management for docx and html output?
@ 2021-07-12 17:42 Andrew Voelkel
       [not found] ` <c708a157-059e-4dc2-a562-797aa11ae620n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Voelkel @ 2021-07-12 17:42 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 2558 bytes --]



Help! I've been messing around for hours and I still can't figure out a 
viable strategy for dealing with images in pandoc documents. The "must 
have" for this project is to be able to get good docx output for the 
images, and be able to have control over the size of the images in the 
docx. 

So far, the only satisfactory results I've gotten are from content 
originating in my drawing program (Omnigraffle), and saved in PDF format, 
then inserted into the docx (via markdown, of course). In this case, the 
original size of the graphic is respected. However, when I try to use pngs 
which I've inherited, Word seems to want to resize them to hit both left 
and right margins, regardless of their original size. I haven't figured out 
a way around this. This is true even if I import the png into the drawing 
program and export as PDF.

So, first question - is there a way to indicate the image size in the 
markdown such that the docx output will reflect that setting?

In addition to the "must have" of good docx output, it would be nice to 
have the html output of the markdown also display the images properly when 
composing the document in markdown. I've noticed that depending on the 
renderer, the {width=400px} directive will sometimes be respected in the 
output. But there are two problems.

First, it doesn't seem that importing PDFs works when rendering markdown to 
html. So the PDFs which are the only solution for docx don't work in this 
situation. 

Second, it would seem that I'd need to have and "ifdef" type of 
functionality in the markdown, so that the image sizing directive could 
depend on whether I'm previewing html or telling pandoc to size the image 
for Word. I don't know of any such thing.

What are other folks doing to deal with these issues? They hardly seem 
exotic. If I could get raster graphics to size properly for both html and 
docx output, I could just save all my graphics as raster graphics, with a 
high DPI value so that the scaling should look OK. But I can't seem to get 
there from here. 

Any help or pointers to in depth information about related subjects would 
be highly appreciated!!

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/c708a157-059e-4dc2-a562-797aa11ae620n%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 2874 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Strategies for image management for docx and html output?
       [not found] ` <c708a157-059e-4dc2-a562-797aa11ae620n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2021-07-13  6:18   ` BPJ
       [not found]     ` <CADAJKhA9nGi_VYT-qbzBTbgeSifxvAy7j2h=m7FFJRYbqRQv1g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: BPJ @ 2021-07-13  6:18 UTC (permalink / raw)
  To: pandoc-discuss

[-- Attachment #1: Type: text/plain, Size: 3728 bytes --]

Have you read the manual section on link/image attributes? You can set
explicit width and height attributes on images.

https://pandoc.org/MANUAL.html#extension-link_attributes

However DOCX has specific problems with TIFF, perhaps also with other
formats?

https://github.com/jgm/pandoc/issues/7405

(Apparently this will be fixed in the next release.)


Den mån 12 juli 2021 19:43Andrew Voelkel <jandyman.voelkel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> skrev:

> Help! I've been messing around for hours and I still can't figure out a
> viable strategy for dealing with images in pandoc documents. The "must
> have" for this project is to be able to get good docx output for the
> images, and be able to have control over the size of the images in the
> docx.
>
> So far, the only satisfactory results I've gotten are from content
> originating in my drawing program (Omnigraffle), and saved in PDF format,
> then inserted into the docx (via markdown, of course). In this case, the
> original size of the graphic is respected. However, when I try to use pngs
> which I've inherited, Word seems to want to resize them to hit both left
> and right margins, regardless of their original size. I haven't figured out
> a way around this. This is true even if I import the png into the drawing
> program and export as PDF.
>
> So, first question - is there a way to indicate the image size in the
> markdown such that the docx output will reflect that setting?
>
> In addition to the "must have" of good docx output, it would be nice to
> have the html output of the markdown also display the images properly when
> composing the document in markdown. I've noticed that depending on the
> renderer, the {width=400px} directive will sometimes be respected in the
> output. But there are two problems.
>
> First, it doesn't seem that importing PDFs works when rendering markdown
> to html. So the PDFs which are the only solution for docx don't work in
> this situation.
>
> Second, it would seem that I'd need to have and "ifdef" type of
> functionality in the markdown, so that the image sizing directive could
> depend on whether I'm previewing html or telling pandoc to size the image
> for Word. I don't know of any such thing.
>
> What are other folks doing to deal with these issues? They hardly seem
> exotic. If I could get raster graphics to size properly for both html and
> docx output, I could just save all my graphics as raster graphics, with a
> high DPI value so that the scaling should look OK. But I can't seem to get
> there from here.
>
> Any help or pointers to in depth information about related subjects would
> be highly appreciated!!
>
> --
> You received this message because you are subscribed to the Google Groups
> "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pandoc-discuss/c708a157-059e-4dc2-a562-797aa11ae620n%40googlegroups.com
> <https://groups.google.com/d/msgid/pandoc-discuss/c708a157-059e-4dc2-a562-797aa11ae620n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhA9nGi_VYT-qbzBTbgeSifxvAy7j2h%3Dm7FFJRYbqRQv1g%40mail.gmail.com.

[-- Attachment #2: Type: text/html, Size: 4792 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Strategies for image management for docx and html output?
       [not found]     ` <CADAJKhA9nGi_VYT-qbzBTbgeSifxvAy7j2h=m7FFJRYbqRQv1g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2021-07-13 17:40       ` Andrew Voelkel
       [not found]         ` <1db7b650-0b44-4eb4-84bf-bdf6a3fd9dd6n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Voelkel @ 2021-07-13 17:40 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 4268 bytes --]

I had sworn that I had tried the image attributes and did not see it 
reflected in the docx output, but apparently I made some sort of mistake, 
because now it is working! Thank you.

Now, if I can just figure out how to get the markdown preview renderer in 
VSCode or MacDown to work properly with the width specifier. But that is a 
"nice to have", not a requirement.

Thanks again. 
On Monday, July 12, 2021 at 11:18:29 PM UTC-7 BPJ wrote:

> Have you read the manual section on link/image attributes? You can set 
> explicit width and height attributes on images.
>
> https://pandoc.org/MANUAL.html#extension-link_attributes
>
> However DOCX has specific problems with TIFF, perhaps also with other 
> formats?
>
> https://github.com/jgm/pandoc/issues/7405
>
> (Apparently this will be fixed in the next release.)
>
>
> Den mån 12 juli 2021 19:43Andrew Voelkel <jandyman...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> skrev:
>
>> Help! I've been messing around for hours and I still can't figure out a 
>> viable strategy for dealing with images in pandoc documents. The "must 
>> have" for this project is to be able to get good docx output for the 
>> images, and be able to have control over the size of the images in the 
>> docx. 
>>
>> So far, the only satisfactory results I've gotten are from content 
>> originating in my drawing program (Omnigraffle), and saved in PDF format, 
>> then inserted into the docx (via markdown, of course). In this case, the 
>> original size of the graphic is respected. However, when I try to use pngs 
>> which I've inherited, Word seems to want to resize them to hit both left 
>> and right margins, regardless of their original size. I haven't figured out 
>> a way around this. This is true even if I import the png into the drawing 
>> program and export as PDF.
>>
>> So, first question - is there a way to indicate the image size in the 
>> markdown such that the docx output will reflect that setting?
>>
>> In addition to the "must have" of good docx output, it would be nice to 
>> have the html output of the markdown also display the images properly when 
>> composing the document in markdown. I've noticed that depending on the 
>> renderer, the {width=400px} directive will sometimes be respected in the 
>> output. But there are two problems.
>>
>> First, it doesn't seem that importing PDFs works when rendering markdown 
>> to html. So the PDFs which are the only solution for docx don't work in 
>> this situation. 
>>
>> Second, it would seem that I'd need to have and "ifdef" type of 
>> functionality in the markdown, so that the image sizing directive could 
>> depend on whether I'm previewing html or telling pandoc to size the image 
>> for Word. I don't know of any such thing.
>>
>> What are other folks doing to deal with these issues? They hardly seem 
>> exotic. If I could get raster graphics to size properly for both html and 
>> docx output, I could just save all my graphics as raster graphics, with a 
>> high DPI value so that the scaling should look OK. But I can't seem to get 
>> there from here. 
>>
>> Any help or pointers to in depth information about related subjects would 
>> be highly appreciated!!
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "pandoc-discuss" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/pandoc-discuss/c708a157-059e-4dc2-a562-797aa11ae620n%40googlegroups.com 
>> <https://groups.google.com/d/msgid/pandoc-discuss/c708a157-059e-4dc2-a562-797aa11ae620n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/1db7b650-0b44-4eb4-84bf-bdf6a3fd9dd6n%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 6435 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Strategies for image management for docx and html output?
       [not found]         ` <1db7b650-0b44-4eb4-84bf-bdf6a3fd9dd6n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2022-08-18 10:03           ` Johan Bergquist
  0 siblings, 0 replies; 4+ messages in thread
From: Johan Bergquist @ 2022-08-18 10:03 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 5994 bytes --]

My workflow is authoring in Word and exporting to PDF (for printing and 
download) and HTML (for online publishing). Because of the printing 
resolution requirements, I need to use scalable vector graphics (SVG) as 
Word doesn't support EPS. While exporting to PDF is done directly with 
Acrobat, I'm using pandoc 2.18 to convert docx to html and the output image 
size is consistent with the original, even after scaling in Word. The size 
shows up as <img> attributes such as "style="width:0.5in;height:0.5in". 
However, I haven't found any way to export the SVG images as is without 
renaming and converting to PNG. I tried to link the images instead of 
embedding them in Word but the files are still PNG and the naming 
(imageN.png) persists. For one particular document, the counter N starts at 
N=4 and after N=5 only even numbers are used. I first thought that this is 
due to the image in the Word header (not converted) but there are only two 
pages before the first body image so it should start at N=3, not N=4. Then 
there is one header between the first and second body image so N=6 for the 
second makes sense. However, body images 3-13 are all in one chunk (inline) 
on the same page so I don't understand why only even numbers are used. My 
current workaround is to name the original files imageN.svg and then do a 
global ".png" to ".svg" search-replace in the html file. This works but the 
file names aren't very descriptive. I'm a relatively new user of pandoc so 
I haven't filed any bugs yet - is github the place to file?

On Wednesday, 14 July 2021 at 02:40:54 UTC+9 Andrew Voelkel wrote:

> I had sworn that I had tried the image attributes and did not see it 
> reflected in the docx output, but apparently I made some sort of mistake, 
> because now it is working! Thank you.
>
> Now, if I can just figure out how to get the markdown preview renderer in 
> VSCode or MacDown to work properly with the width specifier. But that is a 
> "nice to have", not a requirement.
>
> Thanks again. 
> On Monday, July 12, 2021 at 11:18:29 PM UTC-7 BPJ wrote:
>
>> Have you read the manual section on link/image attributes? You can set 
>> explicit width and height attributes on images.
>>
>> https://pandoc.org/MANUAL.html#extension-link_attributes
>>
>> However DOCX has specific problems with TIFF, perhaps also with other 
>> formats?
>>
>> https://github.com/jgm/pandoc/issues/7405
>>
>> (Apparently this will be fixed in the next release.)
>>
>>
>> Den mån 12 juli 2021 19:43Andrew Voelkel <jandyman...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> skrev:
>>
>>> Help! I've been messing around for hours and I still can't figure out a 
>>> viable strategy for dealing with images in pandoc documents. The "must 
>>> have" for this project is to be able to get good docx output for the 
>>> images, and be able to have control over the size of the images in the 
>>> docx. 
>>>
>>> So far, the only satisfactory results I've gotten are from content 
>>> originating in my drawing program (Omnigraffle), and saved in PDF format, 
>>> then inserted into the docx (via markdown, of course). In this case, the 
>>> original size of the graphic is respected. However, when I try to use pngs 
>>> which I've inherited, Word seems to want to resize them to hit both left 
>>> and right margins, regardless of their original size. I haven't figured out 
>>> a way around this. This is true even if I import the png into the drawing 
>>> program and export as PDF.
>>>
>>> So, first question - is there a way to indicate the image size in the 
>>> markdown such that the docx output will reflect that setting?
>>>
>>> In addition to the "must have" of good docx output, it would be nice to 
>>> have the html output of the markdown also display the images properly when 
>>> composing the document in markdown. I've noticed that depending on the 
>>> renderer, the {width=400px} directive will sometimes be respected in the 
>>> output. But there are two problems.
>>>
>>> First, it doesn't seem that importing PDFs works when rendering markdown 
>>> to html. So the PDFs which are the only solution for docx don't work in 
>>> this situation. 
>>>
>>> Second, it would seem that I'd need to have and "ifdef" type of 
>>> functionality in the markdown, so that the image sizing directive could 
>>> depend on whether I'm previewing html or telling pandoc to size the image 
>>> for Word. I don't know of any such thing.
>>>
>>> What are other folks doing to deal with these issues? They hardly seem 
>>> exotic. If I could get raster graphics to size properly for both html and 
>>> docx output, I could just save all my graphics as raster graphics, with a 
>>> high DPI value so that the scaling should look OK. But I can't seem to get 
>>> there from here. 
>>>
>>> Any help or pointers to in depth information about related subjects 
>>> would be highly appreciated!!
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "pandoc-discuss" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/pandoc-discuss/c708a157-059e-4dc2-a562-797aa11ae620n%40googlegroups.com 
>>> <https://groups.google.com/d/msgid/pandoc-discuss/c708a157-059e-4dc2-a562-797aa11ae620n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/94c2ac4c-9a15-4153-a6b4-3a6560ead27bn%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 8218 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-08-18 10:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-12 17:42 Strategies for image management for docx and html output? Andrew Voelkel
     [not found] ` <c708a157-059e-4dc2-a562-797aa11ae620n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-07-13  6:18   ` BPJ
     [not found]     ` <CADAJKhA9nGi_VYT-qbzBTbgeSifxvAy7j2h=m7FFJRYbqRQv1g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2021-07-13 17:40       ` Andrew Voelkel
     [not found]         ` <1db7b650-0b44-4eb4-84bf-bdf6a3fd9dd6n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-08-18 10:03           ` Johan Bergquist

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).