Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ZenPDF

ZenPDF is a web app for running PDF workflows with a background worker.
ZenPDF is a web app for running PDF operations with a background worker.

## Project stages
- Stage 1: Code is written.
Expand All @@ -13,6 +13,17 @@ ZenPDF is a web app for running PDF workflows with a background worker.
- Worker (Python): polls for jobs, processes files, uploads outputs.
- Runs on your local CPU/RAM/disk by default (no GPU unless you add it).

## Tool scope
- ZenPDF exposes a strict 27-tool catalog aligned to iLovePDF parity:
- Merge PDF, Split PDF, Compress PDF
- PDF to Word, PDF to PowerPoint, PDF to Excel
- Word to PDF, PowerPoint to PDF, Excel to PDF
- Edit PDF, PDF to JPG, JPG to PDF
- Sign PDF, Watermark, Rotate PDF, HTML to PDF
- Unlock PDF, Protect PDF, Organize PDF
- PDF to PDF/A, Repair PDF, Page numbers
- Scan to PDF, OCR PDF, Compare PDF, Redact PDF, Crop PDF

## Run locally (dev)
1) Configure environment
- `apps/web/.env.local` (see `apps/web/.env.example`)
Expand Down
1 change: 1 addition & 0 deletions apps/web/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up
NEXT_PUBLIC_CONVEX_URL=
CLERK_JWT_ISSUER_DOMAIN=
CLERK_JWT_AUDIENCE=
ZENPDF_DEV_MODE=1
ZENPDF_ANON_MAX_FILES_PER_JOB=
ZENPDF_ANON_MAX_MB_PER_FILE=
ZENPDF_ANON_MAX_CONCURRENT_JOBS=
Expand Down
8 changes: 0 additions & 8 deletions apps/web/convex/_generated/api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@ import type * as lib_limits from "../lib/limits.js";
import type * as lib_time from "../lib/time.js";
import type * as lib_usage from "../lib/usage.js";
import type * as lib_worker_auth from "../lib/worker_auth.js";
import type * as lib_workflow_compiler from "../lib/workflow_compiler.js";
import type * as lib_workflow_spec from "../lib/workflow_spec.js";
import type * as teams from "../teams.js";
import type * as users from "../users.js";
import type * as workflows from "../workflows.js";

import type {
ApiFromModules,
Expand All @@ -51,11 +47,7 @@ declare const fullApi: ApiFromModules<{
"lib/time": typeof lib_time;
"lib/usage": typeof lib_usage;
"lib/worker_auth": typeof lib_worker_auth;
"lib/workflow_compiler": typeof lib_workflow_compiler;
"lib/workflow_spec": typeof lib_workflow_spec;
teams: typeof teams;
users: typeof users;
workflows: typeof workflows;
}>;

/**
Expand Down
45 changes: 32 additions & 13 deletions apps/web/convex/jobs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,38 @@ const jobOutput = v.object({
sizeBytes: v.optional(v.number()),
});

const HEAVY_TOOLS = new Set([
"ocr-searchable-pdf",
"pdf-to-word-ocr",
"pdf-to-excel-ocr",
const SUPPORTED_TOOLS = new Set([
"merge",
"split",
"compress",
"pdf-to-word",
"pdf-to-powerpoint",
"pdf-to-excel",
"word-to-pdf",
"powerpoint-to-pdf",
"excel-to-pdf",
"edit-pdf",
"pdf-to-jpg",
"jpg-to-pdf",
"sign-pdf",
"watermark",
"rotate",
"html-to-pdf",
"unlock",
"protect",
"organize-pdf",
"pdfa",
"repair",
"page-numbers",
"scan-to-pdf",
"ocr-pdf",
"compare",
"redact",
"crop",
]);

const PREMIUM_ONLY_TOOLS = new Set([
"pdf-to-word-ocr",
"pdf-to-excel-ocr",
const HEAVY_TOOLS = new Set([
"ocr-pdf",
"pdfa",
]);

Expand Down Expand Up @@ -85,7 +107,6 @@ export const createJob = mutation({
inputs: v.array(jobInput),
config: v.optional(v.any()),
anonId: v.optional(v.string()),
devBypass: v.optional(v.boolean()),
},
handler: async (ctx, args) => {
const now = Date.now();
Expand All @@ -100,8 +121,10 @@ export const createJob = mutation({
args.config && typeof args.config === "object" && !Array.isArray(args.config)
? args.config
: undefined;
if (!SUPPORTED_TOOLS.has(args.tool)) {
throwFriendlyError("USER_INPUT_INVALID", { tool: args.tool });
}
const devBypass =
args.devBypass === true &&
process.env.ZENPDF_DEV_MODE === "1" &&
process.env.NODE_ENV === "development";
const planLimits = await resolvePlanLimits(ctx, tier);
Expand All @@ -117,10 +140,6 @@ export const createJob = mutation({
throwFriendlyError("SERVICE_CAPACITY_TEMPORARY");
}

if (tier !== "PREMIUM" && PREMIUM_ONLY_TOOLS.has(args.tool)) {
throwFriendlyError("USER_LIMIT_PREMIUM_REQUIRED");
}

const { counter: usageCounter } = await resolveUsageCounter(
ctx,
userId,
Expand Down
4 changes: 0 additions & 4 deletions apps/web/convex/lib/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ export const FRIENDLY_ERRORS = {
message: "You already have the maximum number of active jobs.",
next: "Wait for existing jobs to finish, then retry.",
},
USER_LIMIT_PREMIUM_REQUIRED: {
message: "This tool is available to Premium supporters only.",
next: "Sign in with a Premium account or run ZenPDF locally.",
},
USER_SESSION_REQUIRED: {
message: "We could not confirm your session for this job.",
next: "Refresh the page or sign in, then retry.",
Expand Down
131 changes: 0 additions & 131 deletions apps/web/convex/lib/workflow_compiler.ts

This file was deleted.

Loading