Skip to content

Commit

Permalink
Adds PDFs as <object> tags.
Browse files Browse the repository at this point in the history
  • Loading branch information
BobHanson committed Dec 9, 2024
1 parent 1f4e539 commit 9d4b0da
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@
if (r.data.indexOf(";base64") == 0) {
if (type == "png") {
var imgTag = "<img id=img" + (++divId) + " onload=IFD.checkImage(" + divId + ")" + " src=\"" + "data:" + r.mediaType + r.data + "\"</img>";
s += addPathForRep(aidID, r.ref, -1, imgTag, null);
s += addPathForRep(aidID, r.ref, -1, imgTag, null);
} else {
s += anchorBase64(r.ref.localPath, r.data, r.mediaType);
}
Expand Down Expand Up @@ -742,7 +742,10 @@

var anchorBase64 = function(label, sdata, mediaType) {
mediaType || (mediaType = "application/octet-stream");
return "<a href=\"data:" + mediaType + sdata + "\")>" + label + "</a>";
var s = "<a href=\"data:" + mediaType + sdata + "\")>" + label + "</a>";
if (mediaType.indexOf("/pdf") < 0)
return s;
return "<object data=\"data:application/pdf" + sdata + "\" type=\"application/pdf\" width=\"800\" height=\"600\">" + s +"</object>";
}

var getSpectrumPrediction = function(props, smiles) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static void main(String[] args) {
String localSourceArchive = dir + "Procter/";
String targetDir = dir + "icl-procter";

String flags = "-insitu";
String flags = null;

new IFDExtractor().runExtraction(ifdExtractFile, localSourceArchive, targetDir, flags);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.integratedgraphics.test;

import com.integratedgraphics.extractor.IFDExtractor;

/**
* Copyright 2021 Integrated Graphics and Robert M. Hanson
*
*
* Just modify the first few parameters in main and run this as a Java file.
*
*
* @author hansonr
*
*/
public class ExtractorTestICL2insitu {

public static void main(String[] args) {
String dir = "c:/temp/iupac/henry/";
String ifdExtractFile = dir + "IFD-extract-procter.json";
String localSourceArchive = dir + "Procter/";
String targetDir = dir + "icl-procter";

String flags = "-insitu";

new IFDExtractor().runExtraction(ifdExtractFile, localSourceArchive, targetDir, flags);
}

}

0 comments on commit 9d4b0da

Please sign in to comment.