Cross platform PDF annotation tool

edited February 2023 in General

Linux currently does not have a desktop tool for annotating drawings, similar to commercial offerings like Bluebeam, or PDF XChange Editor, etc. The required functionality is:

  • Able to annotate text, callouts, arrows, lines, and polygons, with a variety of stroke and fill RGBAs and thicknesses
  • Able to "stamp" a preset graphic or text
  • Extract a subset of pages in a PDF, add new pages to a PDF, reorder pages

Those features already exist in PDF offerings. However, there are a few more features that the AEC industry needs that do not exist to my knowledge:

  • Annotating a dimension line with automatic dimension, applying a scale factor to represent the scale in real world units
  • A ruler calibration tool to calculate an arbitrary or unknown scale factor
  • A polyline measurement tool to calculate the summed length of a polyline, with scale factor applied
  • A polygon measurement tool to calculate the perimeter length, and area of the polygon, with scale factor applied
  • Naturally, support for both imperial and metric real world units
  • The ability to compare two PDFs side by side
  • The ability to overlay a PDF over another, to spot changes between them, perhaps colour coded, or visualised in another way

There are some more features like 3D PDFs, but the vibe I get is that nobody likes it as a developer :)

Some picture examples of commercial tools: one, two, and three.

Ideally these tools should also be available online, through initiatives like first-draft, which can then be embedded in online project / document management tools, but the desktop usecase is also important.

I've spoken to the mupdf devs. They're an active bunch, working on a very small but powerful and nimble codebase. They advise me that the PDF specification which is 1,310 pages long (what a nightmare!) actually does specify this type of measurement / scale factor functionality (pages 627 - line annotations can have a measure dictionary attached, and page 744, like an entire chapter about this stuff).

That's a good sign - since it's in the spec, PDF writers can help implement it :)

I'll reach out to the Okular folks shortly too, and perhaps someone can reach out to Evince, and see if something can happen!

basweinpaulleetheoryshawbitacovircarlopavjtm2020hyo
«1

Comments

  • What about a svg to pdf instead, and handling that on svg side ?

    theoryshaw
  • @stephen_l agree that we should provide tools to deal with it in SVG, which actually would be much, much easier :) In an ideal world, they should just deliver a 3D model, and we measure the model :)

    However, a lot of the industry is still stuck on PDFs, and will continue to deliver PDFs for many years ... :(

    theoryshaw
  • 1+ on prioritizing SVG over PDF.
    I actually think svg has the potential to be a pdf disrupter in our industry.
    Code location for First Draft, just an fyi...
    https://gitlab.com/MeldCE/first-draft
    We use this tool a ton at OpeningDesign.com

  • edited August 2020

    There is Scribus. Maybe you can run it online in a server? Or to store the file in a server with some version control system...
    Also Krita can import PDF with several pages... and it is available for Android...
    can MyPaint import PDF with several pages?
    Or maybe someone could write a plug in for sweetHome3D. It has a online version and some basic drawing features such as areas, lines, text, dimensions. You can scale a background image (BMP,JPG,GIF,PNG). Maybe it is possible to extend these formats to a PDF multi page...

  • I have tried inkscape. It does not make annotations but real objekts instead. But I do not care about this. It works quite well as long as the pdf does not get huge. My second main problem is I do not know inkscape very well but bluebeam really good. Thus it is much much more easier to use bluebeam instead of inkscape. But for small stuff I force myself to use inkscape. There are addons in inkscape for measurement available.

    cheers bernd

  • @Moult, like @bernd said, Inkscape seems to fit the bill for multi platform handling of PDFs and it also works primarily with svgs so it meet's Stephen's suggestion for svg handling as well. It's not hard to learn, especially if you already have some experience with other vector art tools. Its handling of dimensioning is not very smooth, and it's probably not well suited for large projects, but it is in active development, is multiplatform, and open source, meaning it can be improved upon. It reads and writes PDF's fairly well, there are a couple of plugins for exporting multiple pdf pages which you can set up on your canvas, art board style (it would be better though, if they could merge the individual pdfs according to a preferred sequence, in one operation). It also does some of what you've listed with PDFs. For the others, do you think a custom Inkscape plugin targeted at those needs would suffice?

    By the way, I've always wondered why PDF exports are not a standard feature in Blender, it does not seem like a lot of people are talking about that either, because not a lot comes up when I search (apart from exporting svgs and converting with 3rd party tools), and that too makes me wonder.

    iosvarms
  • For annotation, it would help if Inkscape could open the original pdf as a background image, rather than converting every little detail into a native editable object.

  • edited August 2020

    @theoryshaw said:
    1+ on prioritizing SVG over PDF.
    I actually think svg has the potential to be a pdf disrupter in our industry.
    Code location for First Draft, just an fyi...
    https://gitlab.com/MeldCE/first-draft
    We use this tool a ton at OpeningDesign.com

    Since a pdf can be converted in a svg and back this is not to important IMHO. A pdf seams more save because it looks the same on nearly every software out there.

    This tool you mentioned seams a cloud based annotation software?!? Looks interesting and simple. Would you elaborate a bit how the workflow for a usual project on OpeningDesign is? Where is which data saved and where is this tool installed etc.

    cheers bernd

  • @Moult said:
    I'll reach out to the Okular folks shortly too, and perhaps someone can reach out to Evince, and see if something can happen!

    Okular does not even support to show pdf layer ... AFAIK. No possibility to just print some part of the pdf ... Evince is one of the few software from Gtk I have installed and use on regular basis on my KDE desktop.

  • edited August 2020

    On the other hand, pdf require add-on in browser / special viewer software where svg is natively supported everywhere out of the box. While Adobe is no more officially supporting "linux" addon, there is a risk to find yourself with file you can't no more open.
    The major issue with svg lie in the fact that fonts are not embed with the file by default, so either define a webfont or use a font known to be available everywhere. Alternative is to turn font into vector.

  • edited August 2020

    Hi @bernd
    We simply use it to redline drawings--from schematic to production drawings.
    Currently it's hosted here, http://dev.first-draft.xyz/, but could be hosted anywhere relatively easy.
    If you go to that link, it creates a unique url that you can share with your collaborator(s). You can also create custom urls.
    It uses Paper.js which is a pretty robust 'vector graphics scripting framework' and imports/exports svg.

  • edited August 2020

    @Moult said:
    - The ability to overlay a PDF over another, to spot changes between them, perhaps colour coded, or visualised in another way

    Here's a script for diffing PDFs, I find it very useful. It highlights changes in red/cyan, give it a series of drawing revisions and it will produce a diff for each change. When the drawings are not aligned, as typical with scans, I align them first in Hugin:

    #!/usr/bin/perl
    use strict;
    use warnings;
    use 5.010;
    # Compares incremental changes within a series of drawings assuming they have the same size and scale
    # Requires Perl and ImageMagick - Bruno Postle
    while (@ARGV > 1) {
    my $path_a = shift @ARGV;
    my $path_b = $ARGV[0];
    my $path_out = $path_a .' - '. $path_b;
    $path_out =~ s/\//__/gix;
    $path_out =~ s/(\.png|\.jpg|\.pdf|\.tif)//gix;
    my $extension = '.png';
    $extension = '.pdf' if $path_a =~ /\.pdf$/i;
    $path_out .= $extension;
    say STDERR $path_out;
    my $tmp_a = '_tmp_a.png';
    my $tmp_b = '_tmp_b.png';
    my @density = qw/ -density 300 /;
    my @grayscale = qw/ -colorspace Gray /;
    my @flatten = qw/ -flatten -background white /;
    system('convert', @density, @grayscale, @flatten, $path_a, '+level-colors', 'red,', $tmp_a);
    system('convert', @density, @grayscale, @flatten, $path_b, '+level-colors', 'darkcyan,', $tmp_b);
    system('convert', $tmp_a, $tmp_b, '-compose', 'Darken', '-composite', $path_out);
    unlink($tmp_a, $tmp_b);
    } 0;

    Some typical output:

    JesusbillduncanbasweinglobalcitizenLars
  • @DADA_universe said:

    By the way, I've always wondered why PDF exports are not a standard feature in Blender, it does not seem like a lot of people are talking about that either, because not a lot comes up when I search (apart from exporting svgs and converting with 3rd party tools), and that too makes me wonder.

    >

    Having a PDF export would be very useful for producing construction working drawings, cost plans, bills of quantities, etc. directly from Blender. @Moult this could be a feature (probably advanced) in BlenderBim.

    DADA_universe
  • @brunopostle Whoo! I've done (almost) exactly what you've done but with bash instead at my old job. I used slightly different imagemagick commands though, which I stole from this set of imagemagick compare methods. I used the second one - which instead of using an overlay mode, simply uses RB channels from the old, and GB channels from the new.

    The disadvantage is that it has to rasterise it (and in the channel mixing approach, it has to greyscale it too). Thus it is a slower process than a native PDF comparison tool.

    Note a variation of this technique can be used in 3D models - where a translucent red and green model can merge - where murky brown is unchanged, green new, red old.

    brunopostle
  • @stephen_l said
    While Adobe is no more officially supporting "linux" addon, there is a risk to find yourself with file you can't no more open.

    I'm not sure that's accurate. PDF is an ISO standard specification with broad free software support. It doesn't need Adobe to stay useful.
    https://en.m.wikipedia.org/wiki/PDF
    I'm no expert in this field but it's important that a solution allows for finished static documents with an annotation/markup layer. DWF is maybe another option? https://en.m.wikipedia.org/wiki/Design_Web_Format

  • In terms of ecosystem, PDF and SVG are much more further along than DWF, so personally I'd like to start there.

  • @Moult said:
    I used the second one - which instead of using an overlay mode, simply uses RB channels from the old, and GB channels from the new.

    With RGB, mixing red and green channels gives you a murky brown because they are not complementary colours. Green is significantly brighter than red, so I settled on red/darkcyan as a pair that works well in print/screen, maps to expectations about what is removed/added, and that mixes to grey/black.

    Moult
  • Another vote for SVG instead of PDF.
    Reasons:

    • Getting PDF from SVG is easy, the reverse is not so.
    • Modifying SVG is easy on all platforms with free software, modifying PDF is a nightmare.
    Jesusbillbrunopostlebitacovir
  • @globalcitizen said: Modifying SVG is easy on all platforms with free software, modifying PDF is a nightmare.

    Yes, but the fact that PDF is not easy to modify is a feature of submitted project documentation - not a bug. I like what I think @Moult mentioned where a good SVG solution is important - but also a good system of SVG markup over a static PDF - similar to Bluebeam Revu. I would be horrified if I had to send all my work for comment to someone in SVG form and ask them to add markup without disturbing the submitted documents/drawings. That's a coordination nightmare waiting to happen.

    berndiosvarms
  • I feel like SVG and PDF have different use cases. The use case for PDF is for final documentation because if has the benefits of fidelity, the document you produce will maintain its appearance when moving from device to device, computer to printer, and today and 10 years from now, as well as ubiquity, anyone will be able to view your document without jumping through too many hoops.
    The use case for SVG seems to be as a layout and collaborative precursor to a pdf output. It has the benefits of being human legible, as a non programmer I have been able to successfully directly modify the code. It also seems like it would lend itself more readily to version control and real time collaboration such as what @theoryshaw advocated. Here is a good interview with some of the inkscape developers where they talk about the limits of the svg format including the lack of multi page support in the specification and some potential future work arounds. I assume multi page support would be a key feature in documentation. For me real time comments and markup would be amazing.
    I have been thinking about PDF's and conversion in relation to how they are handled in QGIS. In QGIS you can output georeferenced PDF's that you can bring back into QGIS and they appear in the right location on the earth. Unfortunately they are imported as a rasterized image and all of the nice crisp vector lines and text are lost. I have been wondering if the pdf could be displayed as a rasterized version but when you print it it uses the original pdf instead of the raster stand in.

    paulleeJesusbill
  • edited August 2020

    I'm concerned that maybe I haven't got a very sharp grip on the different use cases for SVG and DXF. I'm starting a new thread for that discussion.
    https://community.osarch.org/discussion/170/what-is-best-for-documentation-when-svg-dxf-dwg

    paullee
  • On current tools, just as it hasn't been mentioned, there is also Xournal++ for basic PDF annotation. It can also export to SVG. It seems to be in quite active development and may be interested in adding features.

    infeeeee
  • Per @bytesnz comment here...

    PDF.js also has a project looking at using SVG for rendering https://github.com/mozilla/pdf.js/projects/2

  • @bytesnz said:
    On current tools, just as it hasn't been mentioned, there is also Xournal++ for basic PDF annotation. It can also export to SVG. It seems to be in quite active development and may be interested in adding features.

    Looks pretty cool as simple and fast annotation tool for drawings. It is a pity my ThinkPad X1 Gen 4 has no touch ...

  • Just found LibreOfficeDraw can open and save pdf as vector graphic. It is much simpler to edit and add annotations than inkscape, but one need to be very careful not to edit the pdf but just to add annotations.

    stephen_lJQL
  • @bitacovir but can they leave the PDF alone and add markups and annotations?

  • @duncan said:
    @bitacovir but can they leave the PDF alone and add markups and annotations?

    Yes, I think so. These tools are for online teaching. They are virtual boards. They are very powerfull with many visual tools.
    You can open PDF with several pages, create new pages, from other sources. You can write, draw, insert images. Many interactive things. You can record videos about what you are doing. You can use it for a video conference platform. You can export your editions as new PDF files or as OpenBoard files for other people.

  • edited October 2020

    Yes. I was testing it. And I think it is worth to have a look on OpenBoard. You can do a lot of things with PDF files and other file formats such as images and SVG files too. Also, you can create folders for your projects, importing a lot of files. it is open source and they have a ubuntu version too.


  • @bernd said:
    Just found LibreOfficeDraw can open and save pdf as vector graphic. It is much simpler to edit and add annotations than inkscape, but one need to be very careful not to edit the pdf but just to add annotations.

    LibreOffice Draw has been a life saver for me when I need to edit .pdf files to my taste; including moving single letters :)

Sign In or Register to comment.