Breaking

Monday, September 20, 2021

Azure DevOps–Export wiki to PDF

If you ever want to export your Azure DevOps wiki, you can use the AzureDevOps.WikiPDFExport tool.

  • Start by cloning your Azure DevOps wiki to a local folder.

Troubleshooting

While executing the tool I encountered some issues so here are some troubleshooting tips.

Tip 1 – Ignore the Qt: Could not initialize OLE (error 80010106) warning

If you see a Qt: Could not initialize OLE (error 80010106) warning while executing the tool, don’t worry. You can just ignore this message.

Tip 2 – Be aware about the .order file

The first time I executed the tool only a few of my wiki pages were included. I found out that this was the case because when it detects a .order file it will only include the pages mentioned inside the .order file.

So make sure that all wiki pages are mentioned inside the .order file.

Tip 3 – Specify the ‘—attachments-path’ when your wiki pages include images

When trying to export a wiki page containing images it failed with the following error message:

C:\example\Docs>azuredevops-export-wiki

    WARN: Removing Table of contents [[_TOC_]] from pdf

ERR: Something bad happend.

System.ArgumentNullException: Value cannot be null. (Parameter 'path1')

   at System.IO.Path.Combine(String path1, String path2)

   at azuredevops_export_wiki.WikiPDFExporter.CorrectLinksAndImages(MarkdownObject document, FileInfo file, MarkdownFile mf) in D:\Git\WikiPDFExport\AzureDevOps.WikiPDFExport\WikiPDFExporter.cs:line 674

   at azuredevops_export_wiki.WikiPDFExporter.ConvertMarkdownToHTML(List`1 files) in D:\Git\WikiPDFExport\AzureDevOps.WikiPDFExport\WikiPDFExporter.cs:line 497

   at azuredevops_export_wiki.WikiPDFExporter.Export() in D:\Git\WikiPDFExport\AzureDevOps.WikiPDFExport\WikiPDFExporter.cs:line 149

To fix this error I had to include the ‘--attachments-path’ option and explicitly specify the location of the images:

C:\example\Docs>azuredevops-export-wiki --attachments-path C:\example\Docs\.attachments

Tip 4 – Use the –h option for a good TOC

The tool doesn’t support the TOC (Table of Contents) tag and will be removed from the pdf. As a workaround you can use the ‘-h’ option to create a heading for every wiki page in the PDF file. This doesn’t replace this feature but already helps to make your PDF more accessible.

No comments:

Post a Comment