Use macro to click "Save as PDF" for online location
Answered
Hi all,
I got a quite big project (9000+ references) which contains online locations. I need all of those as downloaded PDF locations which is not practical to be done by hand.
Workflow would be: select reference, show preview of location, click "Save as PDF".
Thus I created a macro to do this for me, but I am stuck at the "Save as PDF" part. I did explore quite a lot of options already but with no real API (is there any?) and only low C# knowledge I am currently lost.
I attached my current efforts -- can anyone help me to automate this? Any hints appreciated!
Cheers,
Q.
(edit: Some more meta information: Citavi 6.3.0.0, Win7, Cloud Project)
Files:
citaviMacro.cs
Dear Q.,
Thank you very much for your message.
My colleague who creates macros for Citavi, will be back in the office on Monday.
Then, he will have a look at your file.
Thank you for your patience!
Kind regards,
Jana
Dear Q.,
Thank you very much for your message.
My colleague who creates macros for Citavi, will be back in the office on Monday.
Then, he will have a look at your file.
Thank you for your patience!
Kind regards,
Jana
Hi Q,
the Citavi method that triggers the HTML to PDF conversion can't be called from a macro. However, it should be easy implementing a similar procedure in a macro using a web service that provides HTML to PDF conversion, e.g. https://www.html2pdfrocket.com/ (this is not a recommendation, just one of many alternatives).
You can get the URI in string format for the reference like so:
Once you have the file, you'll need to create a new Location for the reference in Citavi and add it to that reference.Does this help?
Best regards
Sebastian
Hi Q,
the Citavi method that triggers the HTML to PDF conversion can't be called from a macro. However, it should be easy implementing a similar procedure in a macro using a web service that provides HTML to PDF conversion, e.g. https://www.html2pdfrocket.com/ (this is not a recommendation, just one of many alternatives).
You can get the URI in string format for the reference like so:
Once you have the file, you'll need to create a new Location for the reference in Citavi and add it to that reference.Does this help?
Best regards
Sebastian
Hi Sebastian,
thanks for your pointer. I did eventually think of this way but was unable to include required dlls int the macro editor. From what I can see I would need Microsoft.AspNet.WebApi.Core:
https://www.nuget.org/packages/Microsoft.AspNet.WebApi.Core/
But with the Citavi Macro editor not being a full IDE, all my efforts to add the DLL version via Tools->References did not succeed. Adding some code as described by html2pdfrocet:
will result in errors pointing out that the 'HttpContext' namespace is missing in 'System.Web', even with the correct DLLs references added. Is there any other way to add dependencies/dlls? Am I doing something completely wrong here?
Best,
Q
Hi Sebastian,
thanks for your pointer. I did eventually think of this way but was unable to include required dlls int the macro editor. From what I can see I would need Microsoft.AspNet.WebApi.Core:
https://www.nuget.org/packages/Microsoft.AspNet.WebApi.Core/
But with the Citavi Macro editor not being a full IDE, all my efforts to add the DLL version via Tools->References did not succeed. Adding some code as described by html2pdfrocet:
will result in errors pointing out that the 'HttpContext' namespace is missing in 'System.Web', even with the correct DLLs references added. Is there any other way to add dependencies/dlls? Am I doing something completely wrong here?
Best,
Q
Dear Sebastian,
thanks for the help. I managed to get it working. For future reference I attached my current version of the macro for whoever needs it some day.
But a fair warning: DO NOT simply apply this macro. Read and adapt to your needs first.
Cheers
Q.
Dear Sebastian,
thanks for the help. I managed to get it working. For future reference I attached my current version of the macro for whoever needs it some day.
But a fair warning: DO NOT simply apply this macro. Read and adapt to your needs first.
Cheers
Q.
Dear Q
Thanks for sharing this with us,
Best regards
Sebastian
Dear Q
Thanks for sharing this with us,
Best regards
Sebastian
Replies have been locked on this page!