Giter Club home page Giter Club logo

markdown2pdf's People

Contributors

flayms avatar inopiae avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

inopiae

markdown2pdf's Issues

Default header / footer styling

Automatically add the

<style>
    html {
        -webkit-print-color-adjust: exact;
    }

    #header, #footer {
        padding: 0;
    }
</style>

to the header / footer.

Set title in file properties of PDF file

Is there a way to set the title property in the file properties in the generated PDF file.
As far as I can see the filename of the html file is taken as title property.
image

Rework TOC options

Create separate TOC options class:

  • Add option for MinDepth (e.g. to exclude h1s)
  • Add option for ExcludeRegex (e.g. to exclude ''## Table of Contents")

If only h2-h6 headers set MinDepth to h2 by default.

Add placeholder for manual page break

Add a placeholder for manual page break so a manual page break can be added for the pdf output instead of using

<div style="page-break-after: always"></div>

in markdown document.

Error Await mdconvert.Convert(file.md)

After update from v 1.3.0 to 2.0.0 I get this error.

System.ComponentModel.Win32Exception
  HResult=0x80004005
  Nachricht = An error occurred trying to start process 'C:\...\bin\Debug\net6.0-windows\Chrome\Win64-123.0.6312.86\chrome-win64\chrome.exe' with working directory 'C:\...I\bin\Debug\net6.0-windows'. Das System kann die angegebene Datei nicht finden.
  Quelle = System.Diagnostics.Process
  Stapelüberwachung:
   bei System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
   bei System.Diagnostics.Process.Start()
   bei PuppeteerSharp.States.ProcessStartingState.<StartCoreAsync>d__6.MoveNext()
   bei PuppeteerSharp.Launcher.<LaunchAsync>d__8.MoveNext()
   bei PuppeteerSharp.Launcher.<LaunchAsync>d__8.MoveNext()
   bei Markdown2Pdf.Markdown2PdfConverter.<_CreateBrowserAsync>d__50.MoveNext()
   bei Markdown2Pdf.Markdown2PdfConverter.<_GeneratePdfAsync>d__47.MoveNext()
   bei Markdown2Pdf.Markdown2PdfConverter.<_ConvertInternal>d__44.MoveNext()
   bei Markdown2Pdf.Markdown2PdfConverter.<_Convert>d__43.MoveNext()
   bei Markdown2Pdf.Markdown2PdfConverter.<Convert>d__40.MoveNext()
   bei Markdown2Pdf.Markdown2PdfConverter.<Convert>d__39.MoveNext()
   bei inoPBI.FrmPDF.VB$StateMachine_90_CmdDocumentation_Click.MoveNext() in C:\...\FrmPDF.vb: Zeile64

Line 64 is Dim strPDF = Await mdconvert.Convert(TxtFileDocu.Text)

I get the same error running the unit tests on branch main and develop

System.ComponentModel.Win32Exception : An error occurred trying to start process 'C:\...\Markdown2Pdf\Markdown2Pdf.Tests\bin\Debug\net8.0\Chrome\Win64-123.0.6312.86\chrome-win64\chrome.exe' with working directory 'C:\...\Markdown2Pdf\Markdown2Pdf.Tests\bin\Debug\net8.0'. Das System kann die angegebene Datei nicht finden.

Process.StartWithCreateProcess(ProcessStartInfo startInfo)
ProcessStartingState.StartCoreAsync(LauncherBase p) Zeile 68
Launcher.LaunchAsync(LaunchOptions options) Zeile 66
Launcher.LaunchAsync(LaunchOptions options) Zeile 99
Markdown2PdfConverter._CreateBrowserAsync() Zeile 314
Markdown2PdfConverter._GeneratePdfAsync(String htmlFilePath, String outputFilePath) Zeile 217
Markdown2PdfConverter._ConvertInternal(String outputFilePath, String markdownContent, String markdownFilePath) Zeile 176
Markdown2PdfConverter._Convert(String outputFilePath, String markdownContent, String markdownFilePath) Zeile 158
Markdown2PdfConverter.Convert(String markdownFilePath, String outputFilePath) Zeile 120
Markdown2PdfConverter.Convert(String markdownFilePath) Zeile 103
HtmlTests.TestGeneralFunctionality() Zeile 20
GenericAdapter`1.GetResult()
AsyncToSyncAdapter.Await(Func`1 invoke)
TestMethodCommand.RunTestMethod(TestExecutionContext context)
TestMethodCommand.Execute(TestExecutionContext context)
<>c__DisplayClass1_0.<Execute>b__0()
DelegatingTestCommand.RunTestMethodInThreadAbortSafeZone(TestExecutionContext context, Action action)

running with Microsoft Visual Studio Community 2022 (64-Bit) - Current Version 17.9.5

Contributing Guide line

Are you sure that a new branch should be base on then develop branch.
For me this will lead to inconstitings branches.

Problems running in docker container

Hi

I have some problems converting from .md -> .pdf when I run my Blazor server in a docker containers.

CODE SNIPPET:

// get markdown file reference
string file = ReleaseFileFullPath;

// check file existence
if (!File.Exists(file))
{
    throw new FileNotFoundException($"Could not find file: '{file}'");
}

// convert markdown file to pdf
string tmpPdfFile = Path.GetTempFileName();
var options = new Markdown2PdfOptions()
{
    MarginOptions = new MarginOptions()
    {
        Top = "2cm",
        Bottom = "2cm",
        Left = "2cm",
        Right = "2cm"
    }   
};
Markdown2PdfConverter converter = new Markdown2PdfConverter(options);

await Task.Run(() => converter.Convert(file, tmpPdfFile)).ConfigureAwait(false);

The files are evaluated to this:

file: /app/ReleaseInfo.md
tmpPdfFile : /tmp/tmpXiokNg.tmp

The source .md file EXISTS and the dest .tmp file is created but size is empty and the convert method fails. Any clues on what is wrong?

Change format of numbering of TOC

Currently the numbers in TOC are formatted like this:
Level 1 number
Level 2 small roman numbers
Level 3 - 6 small letters

Adjust formatting to have individual number formatting for each level
Adjust formatting to the following:
Level 1
Level 1.1
Level 1.1.1

How can I add img element in HeaderHtml?

If I add img tag in HeaderHtml, for example:
HeaderHtml = "<img src=\"test.png\" alt =\"Text\"/>"
Or
HeaderHtml = "<img src=\"https://mobile.photoprocenter.ru/files/4552_0.jpg\" alt =\"Text\"/>"
The image is not displayed, no matter what path I specify.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.