# LinkedIn carousel from HTML: slides as one PDF document, made from templates

> A LinkedIn "carousel" is a PDF document post. Render each slide from an HTML template, merge the pages into one PDF, and stay within LinkedIn's limits.

Published 2026-11-08 · https://shareglint.com/en/guides/linkedin-carousel-from-html

On LinkedIn, the swipeable "carousel" most people mean is not a special post type: it is a **PDF uploaded as a document**, shown one page at a time. So making one is two steps — design the slides, put them in one PDF in the right order. This page shows how to render every slide from an HTML template with the post's own words, merge them in a few lines of code, and stay inside the limits LinkedIn documents.

LinkedIn facts below are from LinkedIn's own help and developer pages, read on 2026-11-08. The rendering and merging were run the same day against our API.

## What LinkedIn accepts

From LinkedIn's help article on [sharing documents](https://www.linkedin.com/help/linkedin/answer/a518909/?lang=en) and its FAQ:

- **File types:** PPT, PPTX, DOC, DOCX and PDF; LinkedIn advises "Convert files to PDFs whenever possible to ensure the highest quality upload."
- **Limits:** "The file size cannot exceed 100MB and 300 pages."
- **One document per post**, and a **title is required** ("Add a title to your document and click Done"). The file cannot be swapped after posting; the title and description can be edited.
- **Same page size:** "PDFs with multiple sized pages must be fit to the same page size." Animations are shown as static images.
- **Downloads:** "members who can view your post will be able to download your document as a PDF."

LinkedIn names **no pixel size or aspect ratio** for organic document posts. Square (1080×1080) and portrait (1080×1350) slides are the common choices; portrait slides are taller, so they fill more of a phone screen. Whatever you choose, use it for every slide.

Not to be confused with **carousel ads**: a sponsored format of 2 to 10 image cards, recommended at 1080×1080, up to 10 MB each, JPG or PNG ([LinkedIn ad specs](https://business.linkedin.com/advertise/ads/sponsored-content/carousel-ads/specs)). LinkedIn's Posts API documentation says that kind of carousel can only be sponsored: "Organic carousel is currently not supported."

## Step 1: one template per slide type

A carousel usually has three kinds of slides: a cover with the title and a hook, content slides with one point each, and an end slide with a call to action. Our built-in templates cover exactly those: `carousel-cover` (title, hook, slide count, author), `carousel-slide` (heading, body, slide number, total) and `carousel-end` (headline, call to action, link, author). Each renders in every size preset; `"size": "portrait"` gives 1080×1350, `"square"` 1080×1080.

## Step 2: render each slide as a one-page PDF, then merge

Our PDFs are **one page each** — so the merge happens in your code. With [pdf-lib](https://pdf-lib.js.org/) in Node.js it is a few lines:

```javascript
import fs from 'node:fs';
import { PDFDocument } from 'pdf-lib';

const API = 'https://shareglint.com/v1/images?wait=true';
const headers = { Authorization: `Bearer ${process.env.API_KEY}`, 'Content-Type': 'application/json' };

const author = { author_name: 'Ada Example', author_handle: '@ada' };
const points = [
  ['Version from day one', 'Put /v1 in every path before the first customer arrives.'],
  ['Idempotency keys', 'Retries happen. Make them safe.'],
  ['Errors are an API', 'Stable codes, human messages.'],
];
const total = String(points.length + 2);

const slides = [
  { template: 'carousel-cover', modifications: { ...author, title: '5 things we learned shipping an API', hook: 'Swipe →', slide_count: total } },
  ...points.map(([heading, body], i) => ({
    template: 'carousel-slide',
    modifications: { heading, body, index: String(i + 2), total, author_handle: author.author_handle },
  })),
  { template: 'carousel-end', modifications: { ...author, headline: 'Follow for more', cta_label: 'Read the full post', url: 'example.com/blog', slide_count: total } },
];

// 1. One single-page PDF per slide, all at the same portrait size.
const pdfs = [];
for (const slide of slides) {
  const res = await fetch(API, { method: 'POST', headers, body: JSON.stringify({ ...slide, size: 'portrait', format: 'pdf' }) });
  if (!res.ok) throw new Error(`render failed: ${res.status} ${await res.text()}`);
  const { url } = await res.json();
  pdfs.push(Buffer.from(await (await fetch(url)).arrayBuffer()));
}

// 2. Merge them into one document, slide order kept.
const doc = await PDFDocument.create();
for (const bytes of pdfs) {
  const src = await PDFDocument.load(bytes);
  for (const page of await doc.copyPages(src, src.getPageIndices())) doc.addPage(page);
}
doc.setTitle('5 things we learned shipping an API');
fs.writeFileSync('carousel.pdf', await doc.save());
console.log(`carousel.pdf: ${doc.getPageCount()} pages, ${JSON.stringify(doc.getPage(0).getSize())} pt`);
```

What came out on 2026-11-08: five slides rendered in **0.7–1.0 seconds each**, and the merged `carousel.pdf` had **5 pages of 810 × 1012.5 pt** — 1080×1350 px at 96 px per inch — 180 KB in total, with real, selectable text. Running the same script again took half a second: identical slides are returned from cache and use no quota. Pages come out exactly the same size, which is the one layout rule LinkedIn states.

In Python, [pypdf](https://pypdf.readthedocs.io/) does the same merge (`PdfWriter().append(...)` per file), and on the command line `qpdf --empty --pages slide-1.pdf slide-2.pdf … -- carousel.pdf`; both gave us the same 5-page document.

## From a thread or a blog post

The content usually already exists: a thread on X, a newsletter, the headings of a blog post. Map it to slides in code — the first post or the title becomes the cover, each point one `carousel-slide`, the link and handle the end slide — and keep each slide to one idea. Text that is too long for a slide is shrunk to fit its box by the template, but a slide with 40 words is still hard to read on a phone; split it into two instead.

## Posting it

- **By hand:** start a post, choose to add a document, upload `carousel.pdf`, give it a title. The title shows above the document, so write it like a headline.
- **Through LinkedIn's API:** register the upload with the Documents API (`initializeUpload`), upload the file, and reference the document in a post with the Posts API ([Documents API](https://learn.microsoft.com/en-us/linkedin/marketing/community-management/shares/documents-api)). These are part of the Community Management API, a vetted product: you apply for access, start on a development tier with limited calls, and upgrade to the standard tier. For a person's own profile, the caller must be the document's owner.
- **Through a scheduler** that supports LinkedIn document posts, if you already use one: upload the PDF there.

We do not post to LinkedIn: we make the slides, your code or tool uploads them.

## The same slides for Instagram

Instagram carousels are separate images, not a PDF. Render the same slides with `"format": "png"` and `"size": "portrait"` and post them as a multi-image post; nothing else changes. Sizes for every network, with sources, are on [social media image sizes](https://shareglint.com/en/social-media-image-sizes).

## Cost

One render per slide: a 7-slide carousel is 7 renders, and re-running it with the same text is free. A weekly carousel of 8 slides is about 35 renders a month. The Free plan's 100 renders carry a watermark, which a published carousel should not have; Starter is $9 a month for 2,000 renders ([pricing](https://shareglint.com/en/pricing)).

## FAQ

### How do I make a LinkedIn carousel?

Make the slides as pages of one PDF and upload it as a document in a post. LinkedIn's help says a document can be PPT, PPTX, DOC, DOCX or PDF, up to 100 MB and 300 pages, and needs a title. Members swipe through the pages like a carousel and can download the PDF.

### What size should LinkedIn carousel slides be?

LinkedIn's help pages for organic document posts give no pixel size; they only say that PDFs with pages of different sizes must be fitted to the same page size. Square 1080×1080 and portrait 1080×1350 are common choices. Keep every slide the same size.

### Can I post a LinkedIn carousel through the API?

As a document, yes, with LinkedIn's Documents API (initializeUpload) and Posts API, which are part of the vetted Community Management API. The Posts API docs say organic carousel posts (the ad format) are not supported: "Only create sponsored carousel post."

### Can your API make the whole carousel PDF in one request?

No. Our PDFs are one page each. Render each slide as a one-page PDF (or PNG) and merge them in your code with pdf-lib, pypdf or qpdf — a few lines, shown on this page.
