manuth / MarkdownConverter

Provides the functionallity to convert Markdown-files to html, png, or pdf using vscode.
MIT License
37 stars 11 forks source link

Exporting PDF using custom dimensions #53

Closed professorbunbury closed 4 years ago

professorbunbury commented 4 years ago

The directions for the markdownConverter.Document.Paper.PaperFormat indicated that one can specify "Either the width and the height of the paper or a predefined format"; however, the element does not seem able to accept width and height properties. How does one give the exported PDF custom dimensions? Thank you!

manuth commented 4 years ago

Hi there! Thank you for using MarkdownConverter.

As the paper-format either must be a predefined Format (and, optionally, the Orientation) or custom Width and Height, the IntelliSense won't show you the option to set width and height as long as you have Format or Orientation present in your settings.

Make sure to empty the markdownConverter.Document.Paper.PaperFormat-object before trying to set custom Width and Height using intellisense and you should be fine: image

professorbunbury commented 4 years ago

Thank you for your prompt and very helpful response. I am not sure that I am inputting units in a fashion that the intellisense is prepared to recognize. If I enter allowable units, do the dimensions need to be surrounded by quotation marks? If not, how do I enter the units without generating a syntax error? I am pursuing these questions because I would like to eliminate the empty white space around my Markdown content, and I don't seem able to do so. I have already set all margins to 0cm,

manuth commented 4 years ago

Why - you're right, I'm currently neither forcing the type of the Width and Height properties nor am I forcing the correct usage of units.

I'll add this to the list for the next upcoming release.

You can either pass plain numbers (such as 100) to set the width/height in pixels or you could pass a string containing the number and a unit (such as "21cm") to use the unit of your desire.

professorbunbury commented 4 years ago

Thank you! One more follow-up question: Is there another element that I should be editing to remove the extra white space around the Markdown content of the resulting PDF? No matter what dimensions I input, the result is roughly the same with additional white space added every time. All margins are currently set to 0, so it doesn't appear to be a problem caused by margin settings.

manuth commented 4 years ago

Sadly there is no option other than Margin to set the width of the border. Negative values for the Margin option are disallowed. So there is no way for you to further decrease the margin.

manuth commented 4 years ago

As you don't seem to have any further questions I'll close this issue. Feel free to open up a new one if you have any further question or if you want to report a bug.