I am creating 3d PDF using .prc file. I am able to create PDF using itext library, but the 3d model is not in fit view.
In order to make 3d model in fit view which property needs to be set?
You can find the properties in below pdf.
http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/pdf/pdfs/PDF32000_2008.pdf
While creating 3D stream dictionary, you need to add /OnInstantiate key into 3D stream dictionary. Value of /OnInstantiate will be reference to new stream dictionary in which you can write your fitVisible javascript code as object stream.
You need to write javascript code to calculate camera properties according to your model bounding box.
Below code worked for me.
PdfDictionary dict3D = new PdfDictionary();
dict3D.Put(PdfName.TYPE, new PdfName("3DView"));
dict3D.Put(new PdfName("XN"), new PdfString("Default"));
dict3D.Put(new PdfName("IN"), new PdfString("Unnamed"));
dict3D.Put(new PdfName("MS"), new PdfName("U3D"));
Please ensure the setting the property "MS".
Related
I am using iText 7.2.1.
According to the documentation, I can only find elements like Image, Div, List, Paragraph, Table can be inserted into Document.
I want to draw some diagrams and insert it into my document. I need them to be part of my content stream. The existing PdfCanvas or Canvas can not do that. They seems to accept only absolute positions.
Is there a way inserting diagrams in iText 7?
In a comment you clarified
I want to draw diagrams using PdfCanvas instructions. Is it possible that I don't have to specify absolute position, and the diagram automatically follow the previous paragraph, and next paragraphs automatically follow this diagram. Is SVG the only way to do this?
You can create your diagram in a PdfFormXObject which has its own coordinate system. PdfCanvas instances can also be constructed for form XObjects.
Then you can wrap that XObject in an iText Image which in turn you can add to an iText Document to be automatically positioned.
So for a PdfDocument pdfDocument and a Document document:
PdfFormXObject xobject = new PdfFormXObject(new Rectangle([... area for your diagram ...]));
PdfCanvas pdfCanvas = new PdfCanvas(xobject, pdfDocument);
[... draw diagram on pdfCanvas ...]
Image image = new Image(xobject);
document.add(image);
Is there a way to expose an array of undetermined size to the blueprint editor so that the level/game designer can adjust the size of the array?
In my example, I want an array of gunshot sound effects.
In my header file I have this:
UPROPERTY(EditAnywhere)
USoundBase* MuzzleSound[5];
... but I don't know how to do it without having to already know the size.
Over in BP I want some way to be able to adjust the size to add even more if desired:
Is this possible?
You can use a TArray. TArrays are the default array the editor uses within blueprints.
UPROPERTY(BlueprintReadWrite, EditAnywhere)
TArray<USoundBase*> MuzzleSound;
I'm reading an imageOverlay URL from an ArcGIS webserver that uses the leaflet getBound() coordinates as part of the URL (we have large maps that are filtered for the current window 'extent'). Apologies for not including the actual path (I'm working with sensitive client data). Eg:
http://myarcgiswebserver.com/MapServer/export/dpi=96&format=png32&bbox=27.119750976562504%2C-31.194007509998823%2C32.39044189453126%2C-29.692824739380754&size=1719%2C434
[bbox] = current imageBounds
When dragging my map the imageOverlay url is updated correctly but my leaflet window is no longer aligned to the imageBound values that were set when first adding the imageOverlay which results in a skewed output (this is my assumption):
The only workaround is to remove the existing imageOverlay and add a new one (which ruins the user experience as the map disappears then reappears each time the window is dragged or zoomed).
Am i approaching this problem incorrectly or would the introduction of a function to update the current imageBounds resolve this? Perhaps not a new function but the expansion of setUrl with additional parameters...?
Many thanks for any feedback...
As #ghybs pointed out, your use case might be better served by using the WMS
interface of your ArcGIS server.
Anyway, you say
The only workaround is to remove the existing imageOverlay and add a new one (which ruins the user experience as the map disappears then reappears each time the window is dragged or zoomed).
Well, that glitch is due to you probably doing something like:
Remove old overlay
Add new overlay
Wait until the image is received from the network
Wait one frame so the new overlay is shown
and instead you should be doing something like:
Add new overlay
Wait until the image is received from the network
Remove old overlay
Wait one frame so the new overlay is shown
The problem is just the async wait and the possible race conditions there, but should be easy to hack together, e.g.:
var activeOverlay = null;
var overlayInRequest = null;
map.on('moveend zoomend', {
// If we are already requesting a new overlay, ignore it.
// This might need some additional debouncing logic to prevent
// lots of concurrent requests
if (overlayInRequest) {
overlayInRequest.off('load', showOverlay);
}
overlayInRequest = L.imageOverlay( computeUrl( map.getBounds() ), myOverlayOptions );
overlayInRequest.on('load', showOverlay);
});
function showOverlay(ev) {
activeOverlay.remove();
activeOverlay = overlayInRequest;
activeOverlay.addTo(map);
overlayInRequest = undefined;
}
If you use an ImageOverlay but change its url dynamically, with a new image that reflects a new bounding box, then indeed that is the reason for the behaviour you describe: you display an image that has been generated using a new bbox, but positioned in the initial bbox, since the image overlay remains at the same geographical position on the map.
Instead, it sounds to me that you should use a TileLayer.WMS.
It would automatically manage the bounding box update for you. You may need to find the correct options to fit your service provider required URL syntax, though.
Example: http://playground-leaflet.rhcloud.com/yel/1/edit?html,output
I am creating a pdf-document. First I add a table and some Texts to the PdfWriter. Now I want to add a costum template (including images and texts): I have to get the direct Content, which ist a layer over the PdfWriter-layer:
over= PdfWriter.getDirectContent();
I want to set the template exactly after the content on PdfWriter-layer.
I can use
writer.getVerticalPosition(true)
for my calculation of y-Position on PdfWriter-layer.
This way I can add the costum template to the upper layer at that position. Now back to PdfWriter-layer how can I set the position of PdfWriter-layer after the tempalte on over-layer?!
Can somebody help?
Thanks in advance.
Mixing content added with document.add() and direct content us always a delicate operation. You need to know the height of the custom template and then add some white space that matches that height. However: what are you going to do if the content of the custom template doesn't match the page?
I would advise against your plans, and I would recommend another approach.
I am assuming that your custom template is a PdfTemplate object. In that case, you can wrap this object inside an Image object, and use document.add() to add the template.
See for instance: Changing Font on PDF Rotated Text
In this example, we create a PdfTemplate with a bar code and some text:
PdfTemplate template = canvas.createTemplate(rect.getWidth(), rect.getHeight() + 10);
ColumnText.showTextAligned(template, Element.ALIGN_LEFT,
new Phrase("DARK GRAY", regular), 0, rect.getHeight() + 2, 0);
barcode.placeBarcode(template, BaseColor.BLACK, BaseColor.BLACK);
We want to add this template to a document with document.add(), so we wrap the template inside an Image object:
Image image = Image.getInstance(template);
We can now add this image to the document:
document.add(image);
Afterwards, we can add extra content:
Paragraph p3 = new Paragraph("SMALL", regular);
p3.setAlignment(Element.ALIGN_CENTER);
document.add(p3);
That content is added under the template at the right position. You don't need to worry anymore about getting the Y position with getVerticalPosition() and you don't need to worry about setting the Y position after adding the template. If the template doesn't fit on the current page, it will automatically be moved to the next page.
Important: Maybe you are worried about the resolution of your template. You shouldn't be. If the template consists of vector data, wrapping that data inside an Image object won't change it into raster data. The vector data will be preserved. This is important in the bar code example, because you don't want the quality of your bar code to deteriorate by making it a raster image.
I'm new to mapbox studio and trying to access data in the properties of my uploaded geojson.
Data is successfully added to my style as two layers. Layer one is for the red dots as added as circles and layer two is for the labels as symbols.
As seen here this works fine for values which are directly in the properties object:
Unfortunately it is not possible to display data which is in an object inside the properties object:
My question is, how can I access these values?