Comments (3)
I have this stack trace:
at System. Net.HttpWebRequest.EndGetResponse(lAsyncResult asyncResult)
at System.Net.WebClient.CetWebResponse(WebRequest request, IAsyncResult result)
at System. Net.WebClient.GetWebResponseTaskAsync(WebRequest request)
at System.Net.WebClient.DownloadBitsAsync(WebRequest request, Stream writeStream, AsyncOperation asyncOp, Action 3 completionDelegate)
at PuppeteerSharp.BrowserFetcher.DownloadAsync(String revision) in /home/runner/work/puppeteer-sharp/puppeteer-sharp/lib/puppeteerSharp/BrowserFetcher.cs:line 264
at Markdown2Pdf.Markdown2PdfConverter—CreateBrowserAsync()
at Markdown2Pdf.Markdown2PdfConverter._GeneratePdfAsync(String htmlFilePath, String outputFilePath)
at Markdown2Pdf.Markdown2PdfConverter.Convert(String markdownFilePath, String outputFilePath)
at Cockpit.Core.Services.FileService.GetReleaselnfoBinaryPdfAsync(CancellationToken cancellationToken) in c:\projects\pc\colleqx2\cockpit\source\core\services\Fileservice.cs:line 114
Do I understand it correctly that this converter needs chromium to be available and inside docker container (Linux dist) this is not the case. Also my docker invironment is hosted on a closed eco-system without internet access, thus I can not use this component. Right ?
from markdown2pdf.
Yeah you're right, this package uses PuppeteerSharp to render the PDF, which needs a headless chrome/-ium. Once you have chrome and the specified npm packages though, no internet access is needed.
I haven't completely tested the Linux support but I was assuming it works bc the Github tests are also running on Ubuntu. When I am testing the package with an Ubuntu 22.04 Docker Container though I am also getting the PuppeteerSharp Exception, even with Chromium installed.
Gonna investigate this further.
from markdown2pdf.
Try using Markdown2Pdf v1.3.0 and add the following to your dockerfile (see running in docker):
RUN apt-get update \
&& apt-get install -y w3m \
&& apt-get install -y wget gnupg \
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
&& apt-get update \
&& apt-get install -y google-chrome-stable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf libxss1 \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
To run the container without internet access you also need to install chrome / chromium via the dockerfile.
Then use Markdown2Pdf with the following options:
var options = new Markdown2PdfOptions {
ChromePath = "path-to-chrome",
ModuleOptions = ModuleOptions.FromLocalPath("path-to-node_modules"),
};
Note that without internet the node_modules also need to be installed seperately
from markdown2pdf.
Related Issues (20)
- Code-Syntax Highlighting
- Default header / footer styling
- Combine several md files to one output pdf file HOT 1
- Option to Generate Table of Contents
- Add option to autodetect language in syntax highlighting
- Add placeholder for manual page break HOT 3
- Change format of numbering of TOC HOT 3
- Setup contributing.md
- Contributing Guide line HOT 3
- Rework TOC options HOT 1
- Bug: remove double bullets from toc
- Error Await mdconvert.Convert(file.md) HOT 8
- Set title in file properties of PDF file HOT 4
- How can I add img element in HeaderHtml? HOT 2
- TOC don't work with cyrillic headers HOT 4
- Make all settings settable in Markdown with comment
- Puppeteer has error HOT 4
- The TOC have an unordered list item page HOT 1
- TOC crashes when no titles available
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from markdown2pdf.