Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Process attachments in PDF #872

Closed
opoudjis opened this issue Feb 28, 2024 · 4 comments
Closed

Process attachments in PDF #872

opoudjis opened this issue Feb 28, 2024 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@opoudjis
Copy link
Contributor

opoudjis commented Feb 28, 2024

Follow-on from #709

Attachments are now included in Presentation XML. I describe how in metanorma/metanorma#353

The task for you is to do... something with these attachments in PDF. I don't know what or how, but @ronaldtse has said that this is expected by our clients. The PRs in metanorma-standoc and isodoc are staying draft until you have a resolution to this, but the attachments are currently treated in Presentation XML as links to assets in the attachments subfolder. The Semantic and Presentation XML retain Data URIs for the attachments, but Data URI generation for attachments is optional (though default behaviour.)

@opoudjis opoudjis added the enhancement New feature or request label Feb 28, 2024
@opoudjis
Copy link
Contributor Author

Archive 4.zip

The attached is an example of Presentation XML linking to an attachments folder.

@Intelligent2013
Copy link
Contributor

Intelligent2013 commented Mar 3, 2024

From a.presentation.xml:

	<metanorma-extension>
		...
		<attachment name="spec_helper.rb">data:application/octet-stream;base64,cmVxdWlyZ...</attachment>
		
	</metanorma-extension>
	
	...
	<sections>
		<clause id="_cl" inline-header="false" obligation="normative" displayorder="2">
			<title depth="1">1<tab/>Cl</title>
			<p id="_ea5d9037-eb3f-8819-ce7c-2b595e4dd1c6">
				<link target="/Users/nickn/Documents/Arbeit/upwork/ribose/metanorma-iso/_a_attachments/spec_helper.rb">text</link>
			</p>
		</clause>
	</sections>

Tasks:

  • the data from metanorma-extension/attachment should be included in PDF as attachments
    • if attachment/text() isn't empty, then decode file from base64 and attach it into PDF
    • if ``attachment/text()` is empty, then
      • determine the current XML file name (before .presentation.xml if presents), and
      • attach the file from the folder _{filename}_attachments
  • the click on the link <link target="/Users/nickn/Documents/Arbeit/upwork/ribose/metanorma-iso/_a_attachments/spec_helper.rb">text</link> opens the attached file

@Intelligent2013
Copy link
Contributor

If link/@target contains /_{filename}_attachments/ then it means that this link points to the PDF attachment file.

Intelligent2013 added a commit to metanorma/mn2pdf that referenced this issue Mar 4, 2024
@Intelligent2013
Copy link
Contributor

XSLT and mn2pdf (https://github.com/metanorma/mn2pdf/releases/tag/v1.84) updated to support the attachments in the PDF.

Note: on my machine this message is showing when I tried to open the attachments:

image

image

The preferences allow to open files, but the button Restore isn't enabled.

Example with spec_helper.rb: a.presentation.pdf

I've renamed the attachment to spec_helper.txt in the source Presentation XML and after that everything is working.
Example with spec_helper.txt :a.presentation.pdf

image

When I add the attachment manually by the Acrobat:
image

On the page https://helpx.adobe.com/acrobat/using/attachments-security-risks-reader-acrobat.html:
image
but I didn't change the attachment defaults.

Only way to change it - via Windows registry (found here https://community.adobe.com/t5/acrobat-discussions/adobe-cannot-open-the-file-attachment-because-your-pdf-file-attachment-settings-do-not-allow/td-p/10984499 and https://www.adobe.com/devnet-docs/acrobatetk/tools/AppSec/attachments.html)
.rb is present in the list tBuiltInPermList:
image

I've change to .rb:0:
image

and spec_helper.rb is opening now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

No branches or pull requests

2 participants