Embedding print jobs in external web pages

You can show a print job inside your own application or website with an iframe, for example in an internal dashboard or a customer portal.

Supported URLs

To embed a print job, you must use a Signed URL for one of the following paths:

  1. Embed by print ID:
    Use this URL format when you know the print ID:
    /app/[org-slug]/print/embed/[print-id]
  2. Embed by device and path:
    Use this URL format when referencing the device and print path:
    /app/[org-slug]/print/embed/ref/[device-slug]/[print-path]

These URLs must be signed to ensure secure and authorized access. For details on generating Signed URLs, refer to the Signed URLs Documentation.

Example code

Below is an example of how to embed a print job using an iFrame:

<iframe
  src="https://www.euler3d.com/app/my-org/print/embed/abc123?signed-url-parameters-here"
  width="1000"
  height="800"
  frameborder="0"
  allowfullscreen>
</iframe>

Notes

  • Replace my-org with your organization slug.
  • Replace abc123 with your print ID or the relevant device slug and print path.
  • Ensure the src attribute contains a valid Signed URL.

End-to-end example

This FastAPI app signs a URL for a print with the create_signed_url function from Signed URLs, then serves a page that shows the print in an iframe.

from fastapi import FastAPI, HTTPException
from fastapi.responses import HTMLResponse
import os

# Import your signing logic
from .euler_signed_url import create_signed_url

app = FastAPI()

# Load credentials from environment variables
API_TOKEN_ID = os.getenv("API_TOKEN_ID")
API_SECRET = os.getenv("API_SECRET")

@app.get("/", response_class=HTMLResponse)
async def render_iframe(org_slug: str, print_id: str):
    try:
        # Generate the Signed URL
        url = f"https://www.euler3d.com/app/{org_slug}/print/embed/{print_id}"
        signed_url = create_signed_url(API_TOKEN_ID, API_SECRET, url, ttl_seconds=3600)
    except ValueError as e:
        raise HTTPException(status_code=400, detail=str(e))

    # Return the HTML page with the iframe
    html_content = f"""
    <!DOCTYPE html>
    <html>
    <head>
        <title>Embedded Print Job</title>
    </head>
    <body>
        <iframe src="{signed_url}" width="800" height="600" frameborder="0" allowfullscreen></iframe>
    </body>
    </html>
    """
    return HTMLResponse(content=html_content)

# Run the app using uvicorn (example: uvicorn main:app --reload)