haghish / markdoc

A literate programming package for Stata which develops dynamic documents, slides, and help files in various formats
http://haghish.com/markdoc
87 stars 30 forks source link

Blocked access to file #31

Closed CookieMonster-NZ closed 3 years ago

CookieMonster-NZ commented 3 years ago

Hi all, I am attempting to produce several pdf reports using markdoc from a .do file using-

markdoc AH.HSS.DataImport.do, replace export(pdf) /// date statax style(stata)

While the text is awesome!!, I can not get the images to appear in the pdf and get the following warning.

image

A Google or two later, I think "This is caused by the change of default behavior in version 0.12.6 of wkhtmltopdf" https://stackoverflow.com/questions/62315246/wkhtmltopdf-0-12-6-warning-blocked-access-to-file

https://github.com/wkhtmltopdf/wkhtmltopdf/issues/4408 this lists three potential changes to the config file.

--enable-local-file-access , --log-level info and --allow "."

Not being an expert, my question is how do I implement these in markdoc?

John

haghish commented 3 years ago

quite likely because the wkhtmltopdf has not been updated for years. but you can install the supported version automatically using the install option (do it once to download the binaries). Please let me know if that solves your problem.

Adding these options to markdoc would also mean updating the binaries for it. It is generally a good idea to do that, but I don't really know when will I find the time for it to prepare the binaries for several operating systems... But I will keep this in mind for the next update.

CookieMonster-NZ commented 3 years ago

I did not try the install option, as I was able to solve the problem by a two-step process, i.e. exporting to html then running `wkhtmltopdf' i.e.

markdoc AH.HSS.DataImport.do, replace export(html) date statax style(stata)

wkhtmltopdf AH.HSS.DataImport.html --enable-local-file-access AH.HSS.DataImport.pdf

Note I had to place the --enable-local-file-access within the command, it did not work as a , [option]

haghish commented 3 years ago

that is certainly one way to solve it ;) markdoc does the same, first converts the file to HTML and then prints the PDF.