i'm using a ngx-extended-pdf-viewer with bleeding-edge, but when i download a file, the draws aren't present in pdf.
<ngx-extended-pdf-viewer
[useBrowserLocale]="true"
height="100vh"
[textLayer]="true"
[showHandToolButton]="true"
[showPresentationModeButton]="true"
[showDownloadButton]="false"
[base64Src]="base64" ></ngx-extended-pdf-viewer>
How is possibile?
Thanks
<ngx-extended-pdf-viewer
[useBrowserLocale]="true"
height="100vh"
[textLayer]="true"
[showHandToolButton]="true"
[showPresentationModeButton]="true"
[showDownloadButton]="false"
[base64Src]="base64" ></ngx-extended-pdf-viewer>
Related
I am using TCPDF to generate a 2 page pdf document.
I have added a header and a footer to the document. The text part of the header and footer shows up correctly on each page however when I include an image logo in the header it is only showing up on the first page.
public function Header()
{
$this->Image('/home/xxxxxx/public_html/xxxxxxxx/uploads/logo/logo.png',10,6,0,13);
$this->SetFont('helvetica','B',20);
$this->Cell(80);
$this->Cell(0,0, $project->name . ' - Project Plan',$frame,0,'R');
$this->Ln(8);
$this->SetFont('helvetica','',10);
$this->Cell(0,0, $organisation->name,$frame,0,'R');
$this->Ln(10);
}
Does anyone have any idea what I am doing wrong here?
Thanks
I think is not related to header/footer, but I think TCPDF has bug that broken Image function with same image file loaded multiple times as reported here TCPDF - image displayed only once
bug also present on actual version tecnickcom/tcpdf:6.2.26
I resolve this problem by loading image outside and pass to the function as string.
public function Header()
{
$this->Image('#'.file_get_contents('/home/xxxxxx/public_html/xxxxxxxx/uploads/logo/logo.png'),10,6,0,13);
$this->SetFont('helvetica','B',20);
$this->Cell(80);
$this->Cell(0,0, $project->name . ' - Project Plan',$frame,0,'R');
$this->Ln(8);
$this->SetFont('helvetica','',10);
$this->Cell(0,0, $organisation->name,$frame,0,'R');
$this->Ln(10);
}
As said it is a tcpdf bug. In my case I had two logos in header one png and the other jpg. The problem happened only with the .png. Changing the image type from png to jpg solved the issue.
I solved this by using base64 encoded string like this:
$image = base64_encode(file_get_contents('path_to_image'));
Then you can use it like this:
<img src="#<?= $image ?>" />
The following is my code for building a 3D Earth and showing it:
com.google.ar.sceneform.rendering.Texture.Builder builder= com.google.ar.sceneform.rendering.Texture.builder();
builder.setSource(context,R.drawable.earth);
builder.build().thenAccept(texture ->
MaterialFactory.makeOpaqueWithTexture(context, texture).
thenAccept(material -> {
earthSphereRenderable =
ShapeFactory.makeSphere(0.1f, new Vector3(0.0f, 0.0f, 0.0f), material);
Toast.makeText(context,"All done",Toast.LENGTH_SHORT).show();})
);
The Toast message is coming but I am not able to see any object. Please note that R.drawable.earth is the Earth.jpg file that I put in there, which I want to show in AR.
Here is where I am rendering it
cornerNode = new Node();
cornerNode.setParent(this);
cornerNode.setLocalPosition(localPosition);
cornerNode.setRenderable(earthSphereRenderable);
Moreover, if I replace makeOpaqueWithTexture with makeOpaqueWithColor and but color as Red then the whole thing is working fine (i.e. I can see the sphere)
What must I change here in order to be able to see the sphere with Earth's texture on it?
At this time Google Sceneform 1.8 supports 3D assets in the following formats: .obj, .glTF for which animations not supported) and .fbx with or without animations. Supported textures' formats are: .mtl, .bin, .png and .jpg.
To import a new 3D asset with textures follow these steps:
Verify that your project's app folder contains a sampledata folder. To create the folder, right-click on the app folder in the Project window, then select New > Sample Data Directory.
The sampledata folder is part of your Android Studio project, but its contents will not be included in your APK. Copy your 3D model source asset file (.obj, .fbx, or .gltf), and all of its dependencies in any of the following formats:
.mtl
.bin
.png
.jpg
into the sampledata folder.
Do not copy these source files into your project's assets or res folder, as this will cause them to be included in your APK unnecessarily. Right click the 3D model source asset and select Import Sceneform Asset to begin the import process.
The values are used by the sceneform.asset() entry in the app's build.gradle, and determine where the .sfa and .sfb – ascii and binary asset definition – files (as well as their corresponding texture files .sfm) will be generated in your project. If you're importing a model for the first time, use the default values.
Hope this helps.
Ok, I got the answer to this. It does not accept jpg files but it accepts png files. Weird stuff!
Using Octave, I am able to show a image and then plot some red circles over it, as follow:
tux = imread('tux.png');
imshow(tux);
hold on;
plot(100,100,'r','markersize', 10);
plot(150,200,'r','markersize', 10);
The above code display this window:
My question is: How can I save this image as it is being showed inside the window?
Thank you very much!
Pretty simple. Use:
print -djpg image.jpg
print is a command in Octave that allows you to capture what's currently seen in the current figure window. -d specifies what output device you want to write to. There are multiple "devices" you can use to save to file... EPS, PS, TEX, etc. A device can also be an image writer, and so here I chose JPEG. You can choose other valid image formats that are supported by Octave. Take a look at the link I provided above for more details.
After, you just specify what file name you want to save the plot to. In this case, I chose image.jpg.
You can also take a look at saveas. Make sure you get a handle to the current figure first before doing so:
h = gcf;
saveas(h, "image.jpg");
Also... a more point-and-click approach would be to Go to File -> Save As in the figure that your image is displayed in :)
You can use print to save your plot to a file:
print (FILENAME, OPTIONS) // for the current figure
print (H, FILENAME, OPTIONS) // for the figure handle H
and also take a look to saveas
saveas (H, FILENAME)
I am receiving a SVG back from our server that I need to display. What the server is returning is:
preview = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"256\" height=\"256\" preserveAspectRatio=\"xMedYMed meet\" viewBox=\"-10756457.3242036 -5943062.39021874 1277.60796701722 1244.16676712781\">\n <path d=\"M -10756407.324203580617905 -5942993.280961670912802 L -10756388.214946510270238 -5941880.166737286373973 -10755229.716236563399434 -5941868.223451617173851 -10755244.048179365694523 -5942728.140019812621176 -10755394.533578801900148 -5942730.528676947578788 -10755396.922235935926437 -5943012.390218744985759 -10755578.460178112611175 -5943005.224247347563505 -10755671.617806335911155 -5942995.669618809595704 -10755764.775434559211135 -5943005.224247347563505 -10755845.98977711237967 -5942990.892304535955191 -10755958.256662406027317 -5943000.446933076716959 -10756166.069833055138588 -5943002.835590209811926 -10756216.231632867828012 -5942998.058275939896703 -10756261.616118412464857 -5942990.892304535955191 -10756347.607775231823325 -5943002.835590209811926 Z\" stroke-width=\"1\" fill=\"black\" stroke=\"black\">\n </path>\n</svg>";
I am looking at the library the SVGKit. I'm not exactly sure what I can do with this information. Can SVGKit load this type of data or does it need to be a local SVG file?
We want to use this SVG cause its a lot smaller then a .png and the server is returning lots of them.
Any ideas on what I can do?
According to the documentation you can load an SVG file from data which is what you have.
To create a custom header and footer, I used TCPDF's header() and footer() functions, but when I try to include an image in the header using the function $this->image(), the image cannot be displayed. Other images in the document are working fine.
Try this example:
$pdf->SetHeaderData("image.jpg", PDF_HEADER_LOGO_WIDTH, "Application PDF", "Application Form\nRaining Pesos, Inc. - www.rainingpesos.com");
The first parameter is where you put the image on the header, but make sure on your path image config,
define ('K_PATH_IMAGES', '/images/');
make sure the images that you want to display on the pdf is in the folder you set, in this example the folder 'images' contains the 'image.jpg'.
Hope it helps!